Hi
I had developed a application in ruby on rails and deployed with the help of this link https://www.digitalocean.com/community/tutorials/how-to-automate-ruby-on-rails-application-deployments-using-capistrano and i have set ruby application correctly ngnix/default.conf file also but when trying to access my application through ip address its showing 404 Not Found in my browser but i have tested with html test page with same path its working fine and this is what my conf files
server {
listen 80;
server_name xxx.xxx.xxx.xxx;
root /home/deployer/app-name/current/app/views/sessions/login.html.erb;
passenger_enabled on;
#charset koi8-r;
access_log /var/log/nginx/alemany.access.log main;
error_log /var/log/nginx/alemany.error.log;
#root /usr/share/nginx/html;
#index index.php index.html index.htm ;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
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!
The root directive shouldn’t point to a specific file. Instead, it should point to the application’s public/ directory. Here is a minimal working example:
server {
listen 80;
server_name xxx.xxx.xxx.xxx;
root /home/deployer/app-name/public;
passenger_enabled on;
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Note that I also removed the location ~ \.php$ section. This is not needed for a Rails application, only PHP one.
For more information, check out this tutorial that walks through setting up Rails and Nginx with Passenger start to finish:
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.