R
R
rhost2015-03-08 17:02:43
Django
rhost, 2015-03-08 17:02:43

Welcome to nginx instead of a website, how to fix it?

Nginx for some reason gives the default page "Welcome to nginx!" , everything seems to be correct in the configs, please tell me how to solve the problem
/etc/uwsgi/apps-available/site.ini

[uwsgi]

socket = 127.0.0.1:9000

plugins = python3
virtualenv = /home/web/env/
chdir = /home/web/src/
pythonpath = /home/usr/bin/python3
env = DJANGO_SETTINGS_MODULE=settings.dev
touch-reload = /home/web/uwsgi
check-static = /home/web/static/
module = django.core.wsgi:get_wsgi_application()

/etc/nginx/sites-available/site
upstream uwsgi_app_servers {
    server 127.0.0.1:9000;
}

server {
    listen      80;
    server_name 127.0.0.1;
    charset     utf-8;
    index off
    client_max_body_size 50M;

    access_log /var/log/nginx/site.access.log;
    error_log /var/log/nginx/site.error.log debug;  

    location ~ /\.ht {
        deny all;
    }

    location / {
        include	uwsgi_params;
        uwsgi_pass	unix:///var/run/uwsgi/app/site/socket;
        
        send_timeout 300s;
        proxy_connect_timeout 300s;
        proxy_send_timeout 300s;
        proxy_read_timeout 300s;
        proxy_buffering off;
        proxy_redirect off;
        proxy_intercept_errors off;
        server_name_in_redirect off;
    }
    
    location /media  {
        alias /home/web/media;
    }

    location /static {
        alias /home/web/static;
    }
}

nginx.conf
user www-data;
worker_processes 4;
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;

  # server_names_hash_bucket_size 64;
  # server_name_in_redirect 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";

  # gzip_vary on;
  # gzip_proxied any;
  # gzip_comp_level 6;
  # gzip_buffers 16 8k;
  # gzip_http_version 1.1;
  # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

  ##
  # nginx-naxsi config
  ##
  # Uncomment it if you installed nginx-naxsi
  ##

  #include /etc/nginx/naxsi_core.rules;

  ##
  # nginx-passenger config
  ##
  # Uncomment it if you installed nginx-passenger
  ##
  
  #passenger_root /usr;
  #passenger_ruby /usr/bin/ruby;

  ##
  # Virtual Host Configs
  ##

  include /etc/nginx/conf.d/*.conf;
  include /etc/nginx/sites-enabled/*;
}


#mail {
#	# See sample authentication script at:
#	# http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
# 
#	# auth_http localhost/auth.php;
#	# pop3_capabilities "TOP" "USER";
#	# imap_capabilities "IMAP4rev1" "UIDPLUS";
# 
#	server {
#		listen     localhost:110;
#		protocol   pop3;
#		proxy      on;
#	}
# 
#	server {
#		listen     localhost:143;
#		protocol   imap;
#		proxy      on;
#	}
#}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri Shikanov, 2015-03-08
@hoOstel

В /etc/nginx/sites-enabled/ есть симлинк на /etc/nginx/sites-available/site ?
После изменения конфигов делали nginx reload/restart ?

Вячеслав Алексеев, 2015-03-08
@AlexeevVyacheslav

Во-первых: в sites-enabled есть ссылка на sites-available/site ?
Во-вторых:
вместо 127.0.0.1 впиши домен или
для того, чтобы хост был доступен по IP

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question