I’m trying to get nginx to work on my server. I was trying to get it to work with a more complex config, but I gave up and reinstalled it. I’m working with a really simple config here:
**File: /etc/nginx/nginx.conf **
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
**File: /etc/nginx/sites-enabled/default **
server { listen 80 default_server; listen [::]:80 default_server;
root /var/www/html;
index index.html index.nginx-debian.html;
server_name [mydomain] [www.mydomain];
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
I followed the instructions on: https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04
I still get a This site can’t be reached [my IP] refused to connect.
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!
Have you tried server_name 127.0.0.1; where 127.0.0.1 works for localhost but you can change it for the real server’s IP?
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.