Reputation: 7893
I have installed last stable version of NGINX (1.10)
In my Rails project I have created nginx.conf
file:
upstream puma_myapp {
server unix:///var/www/myapp/shared/tmp/sockets/myapp.sock;
}
server {
listen 80 default_server deferred;
# server_name example.com;
root /var/www/myapp/current/public;
access_log /var/www/myapp/current/log/nginx.access.log;
error_log /var/www/myapp/current/log/nginx.error.log info;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @puma;
location @puma {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://puma_myapp;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 10M;
keepalive_timeout 10;
}
I have deploy my rails application via capistrano. It deamonized my application.
Now in /etc/nginx
there is no sites-enabled
folder. I have created this folder then I have written this:
sudo ln -nfs "/var/www/myapp/current/config/nginx.conf" "/etc/nginx/sites-enabled/myapp"
Then I restart my nginx:
sudo service nginx restart
When I open my page address, I still get nginx's default page, why this is happening?
My puma.rb
file is:
#!/usr/bin/env puma
directory '/var/www/myapp/current'
rackup "/var/www/myapp/current/config.ru"
environment 'production'
pidfile "/var/www/myapp/shared/tmp/pids/puma.pid"
state_path "/var/www/myapp/shared/tmp/pids/puma.state"
stdout_redirect '/var/www/myapp/current/log/puma.error.log', '/var/www/myapp/current/log/puma.access.log', true
threads 4,16
bind 'unix:///var/www/myapp/shared/tmp/sockets/myapp.sock
workers 0
My var/log/nginx/error.log
file shows this:
2016/08/16 10:07:01 [error] 10157#10157: *1 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 178.88.194.6, server: localhost, $
2016/08/16 10:14:49 [error] 10157#10157: *3 open() "/usr/share/nginx/html/phpMyAdmin/scripts/setup.php" failed (2: No such file or directory), client: 203.110.167.86, $
2016/08/16 10:14:55 [error] 10157#10157: *4 open() "/usr/share/nginx/html/pma/scripts/setup.php" failed (2: No such file or directory), client: 203.110.167.86, server:$
2016/08/16 10:15:00 [error] 10157#10157: *5 open() "/usr/share/nginx/html/myadmin/scripts/setup.php" failed (2: No such file or directory), client: 203.110.167.86, ser$
2016/08/16 10:36:20 [error] 26599#26599: *1 open() "/usr/share/nginx/html/admin" failed (2: No such file or directory), client: 178.88.194.6, server: localhost, reques$
2016/08/16 10:42:11 [error] 27962#27962: *1 open() "/usr/share/nginx/html/admin" failed (2: No such file or directory), client: 178.88.194.6, server: localhost, reques$
Upvotes: 0
Views: 1465
Reputation: 2586
Your bind socket within puma.rb
does not match your socket within nginx.conf
Edit after question update:
PMA? It seems like you'r using plesk to adminstrate your system. plesk generates a lot of stuff. You have to check where plesk want's your configs.
Upvotes: 1
Reputation: 15110
The sites-enabled
directory is a Debian package specific feature. If you have installed other nginx package or built it yourself, then the nginx.conf
is likely doesn't contain the include /etc/nginx/sites-enabled/*;
directive, and configuration files from this directory are not included.
Upvotes: 1