RUN RAILS SERVER ON PORT 443

If we want to run the rails application in port 443 :-

I have added the below line in /config/environments/production.rb:
config.force_ssl = true
Now I have tried the below attempts:
  1. Start rails on 3000
    SSL=true rails s -e production -p 3000
It runs rails on https://project.com but 404 error on http://project.com
  1. Start rails on 443 and mentioned the same port in script:
    rvmsudo rails s -p 443
  2. Start rails on 80 and 443 both using two different pid:
    rvmsudo rails s -p 80 -P PID1
    rvmsudo rails s -p 443 -P PID2
4.Finally I have tried to forward request to 3000 from 443 and 80:
sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3000
sudo iptables -t nat -I PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 3000 

We can also follow the link below :-

https://stackoverflow.com/questions/27560744/run-rails-on-secure-https-and-redirect-non-securehttp-request-to-secure-thro 

Comments

Popular posts from this blog

psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

CARRIERWAVE - UPLOAD ANY MEDIA (AUDIO , VIDEO AND IMAGE ) FILE IN RAILS

SELECT COUNTRY WITH STATE AND IT'S CITIES RAILS

RAILS: UPLOADING PHOTOS VIA AMAZON S3 AND PAPERCLIP (UPLOADING FILES TO S3 IN RUBY WITH PAPERCLIP)

SEARCHING USING AJAX IN RAILS

UPLOAD ANY MEDIA FILE IN RAILS USING PAPERCLIP

UNINITIALIZED CONSTANT PAPERCLIP::STORAGE::S3::AWS

CURL COMMAND ON RUBY ON RAILS

CHECK PASSENGER RUBY PATH