简体   繁体   中英

setting up nginx.conf file

I have a vps with passenger and nginx installed and I am trying to get my app deployed, however, I'm getting 404 error. In the VPN my app is located in:

~/app1

so in my nginx.conf file I have the following:

 server {
        listen       80;
        server_name  localhost;

        location / {
            root /app1/public;
        }

        passenger_enabled on; 
 }

However, I also tried setting root to ~/app1/public, but still got a 404, so I'm not quite sure how to set it up.

Also, I don't quite understand and pointing it to public will work, I don't have a default index.html file, rather in my routes.rb I define root :to => "controller#index". So how does passenger find the index page inside my /views when I am pointing to the public directory?

Thanks

Try this

server {
    listen 80;
    # server_name mysite.com;
    root /app1/public;
    passenger_enabled on;
}

and then restart nginx:
$ sudo service nginx restart

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM