How to solve IP canonicalization in Nginx?
ls /etc/nginx/sites-enabled
WordPress
cat /etc/nginx/sites-enabled/wordpress
ServerName mysite.com
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!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
I have this question too, but I already run more than one site. I do have a file in sites available title digitalocean and this is the key part I tried to make it like your example above.```server { listen 80 default_server; listen [::]:80 default_server;
Make sure
server_name
is set tomysite.com
and that the listen line doesn’t containdefault_server
in/etc/nginx/sites-enabled/wordpress
.Then, add a new virtualhost called
default
with the following config:Finally, restart nginx:
This should make sure your site is served only when you’re accessing it using the domain name. The IP address will just return a 403 Forbidden error.