Hi, I already tried to search a lot but, I admit, I’m stuck. So I would like to check with you what I have and what I want to achieve:
$ORIGIN mydomain1.com. $TTL 1800 mydomain1.com. 1800 IN A xxx.xxx.xx.xxx ( A record @ => xxx.xxx.xx.xxx) test.mydomain1.com. 1800 IN A xxx.xxx.xx.xxx (A record test => xxx.xxx.xx.xxx) www.mydomain1.com. 1800 IN A xxx.xxx.xx.xxx (A record www => xxx.xxx.xx.xxx) NS & Co. records ok …
Question: “www” and “test” should be A records or CNAME records?
Then, server side, with NGINX:
available-site: mydomain1.com
server {
listen 80;
root /var/xxxxxx/mydomain1.com/xxx;
index index.php;
server_name mydomain1.com www.mydomain1.com;
...
It works. Basic stuff right?
Again I searched and I found it is well covered and documented. So I followed and tried:
server {
listen 80;
root /var/xxxxxx/mydomain1.com/xxx;
index index.php;
server_name mydomain1.com www.mydomain1.com;
return 301 $scheme://mydomain1.com$request_uri;
...
I got the following message:
“Page is not working” “mydomain1.com redirected you too many times ERR_TOO_MANY_REDIRECTS”
2 questions:
server_name mydomain1.com www.mydomain1.com; or server_name www.mydomain1.com mydomain1.com; or server_name www.mydomain1.com;
And why I got this error.
When I play around even if I get the error if I do “curl -I http://www.mydomain1.com” I got the following output:
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Sun, 17 Apr 2016 08:52:47 GMT
Content-Type: text/html
Content-Length: 178
Connection: keep-alive
Location: http://mydomain1.com/
But as soon as I hit the browser I receive the error…
Can you please help me to solve this. Thank you.
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!
So I found something with the help of this (one more) great resource. https://www.digitalocean.com/community/tutorials/how-to-redirect-www-to-non-www-with-nginx-on-centos-7
I created a /etc/nginx/conf.d/redirect.conf and put:
server {
server_name www.mydomain1.com;
return 301 $scheme://mydomain1.com$request_uri;
}
Then on site available for domain1.com
server_name mydomain1.com;
I hope it will help someone.
At least even if it works, can you confirm this is the right way…
Thank you
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.