By mrparker
example.com is my site’s url.
It has a redirect loop on the line where it redirects to https.
Any fix?
Also how would I hide the PHP extension?
I have nginx 1.9.3 on ubuntu.
server {
listen 80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php;
server_name example.com;
return 301 https://example.com$request_uri; # Where it loops
error_page 500 /500.html;
error_page 404 /404.php;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
#htacess stuff
}
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Change
return 301 https://example.com$request_uri; to
return 301 https://$server_name$request_uri;
And where is your 443 listen? You can’t point to https if you didn’t set it up :)
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.