Neeraj Kumar

Joined

30 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in Getting a 403 on Ubuntu + Nginx

Your issue is coming because nginx is trying to search for index.html file into /home/deploy/apps/mll/current/public which is not present there.
In order to fix, you will need to add passenger with your nginx. 

Instructions to follow.
      
    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
    sudo apt-get install -y apt-transport-https ca-certificates

Add Passenger APT repository

    sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger xenial main > /etc/apt/sources.list.d/passenger.list'
    sudo apt-get update

Install passenger and nginx

    sudo apt-get install -y nginx-extras passenger

Now start nginx webserver.

    sudo service nginx start

Next, we need to update the Nginx configuration to point Passenger to the version of Ruby that we're using.

    sudo vim /etc/nginx/nginx.conf

And add or uncomment

    include /etc/nginx/passenger.conf;

Save and close nginx.conf. Then open ```/etc/nginx/passenger.conf```

    sudo vim /etc/nginx/passenger.conf

If you are using .rbenv, then

    passenger_ruby /home/deploy/.rbenv/shims/ruby;

Or if you are using rvm, then

    passenger_ruby /home/deploy/.rvm/wrappers/ruby-2.5.0/ruby;

Or if you are using system ruby, then

    passenger_ruby /usr/bin/ruby;

Next, restart nginx server

    sudo service nginx restart

Add ```passenger_enabled on;``` into your site-enabled/centers or site-enabled/nodeapp file.
    server {
            listen 80;
            listen [::]:80;
    
            root /home/deploy/apps/wiki11/current/public;
            index index.html index.htm;
    
            server_name wiki11.com www.wiki11.com;
            passenger_enabled on;
    
            location / {
                    # try_files $uri $uri/ =404;
            }
    }


Note: this configuration used for my application wiki11 which is deployed on https://www.wiki11.com and its working fine.

Restart nginx server again, 
sudo service nginx restart. 
Hopefully it should work.

For more details, follow,
https://www.phusionpassenger.com/library/install/nginx/install/oss/xenial/

Posted in File Uploads with Refile Discussion

Awesome.

Posted in Comments With Polymorphic Associations Discussion

Awesome Video. I really liked and refreshed my concepts about Polymorphic Associations. Thanks :)