At my ubuntu server, I install nginx and setup virtual host using this article. https://www.digitalocean.com/community/articles/how-to-set-up-nginx-virtual-hosts-server-blocks-on-ubuntu-12-04-lts--3
The virtual host's domain name is like www.example.com. When I go to www.example.com, I can see my application's index page. However, when I go to the real ip address, I still see the nginx welcome page. What can I do to remove this welcome page or point to www.example.com if someone uses ip address to access my site?
I setup a A record to point ip xxx.xxx.xxx.xxx to www.example.com.
Also you could just delete the default index files in your /var/www/html folder and you would no longer get the welcome page.
By default Nginx Web server default location is at /usr/share/nginx/html which is located on the default file system of the Linux.
I think when you first set up nginx it comes with a "default" virtual host. Did you tried removing that? Did you tried deleting the symlink? A third option would be to add a "deny all;" on the location / of the default virtual host.
I am not exactly sure if that will work and I cannot test it right now. If the above do not work, try this out: http://nginx.org/en/docs/http/request_processing.html#how_to_prevent_undefined_server_names
http://your-server-ip/
is a request with undefined server name. You should be able to block it with:
server { listen 80; server_name ""; return 444; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With