I have set up an nginx server with a WordPress site, but if I put the IP address in my web browser, nginx shows the “Welcome to nginx!” page instead of the site that I have installed.
How do I make all browsers coming to the server using the IP address go to my default site?
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!
First, you can remove or replace that default nginx welcome page. It’s a static index.html file located in /var/www/html.
The following code snippet will redirect any requests for your IP to the domain (after domain.tld is replaced with your domain and [ip address] is replaced with your droplet’s public IP]:
server {
listen 80;
server_name [ip address];
return 301 $scheme://domain.tld$request_uri;
}
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.