Skip to content

Instantly share code, notes, and snippets.

@Anyoks
Last active March 22, 2018 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Anyoks/51419f8f8a81649c9209ed78511b36e4 to your computer and use it in GitHub Desktop.
Save Anyoks/51419f8f8a81649c9209ed78511b36e4 to your computer and use it in GitHub Desktop.
Deploying two separate rails Apps to subdomain and main domain. These are the nginx conf files found in /etc/nginx/sites-available
#config for the domain
server {
listen 80 default_server;
listen [::]:80;
server_name miraclemanner.org miraclemanner.org;
passenger_enabled on;
passenger_app_root /home/deploy/miracle_manner/current;
rails_env production;
root /home/deploy/miracle_manner/current/public;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
location = /50x.html {
root html;
}
#config for the subdomain
server {
listen 80;
listen [::]:80;
server_name test.web.org www.test.web.org;
rails_env production;
root /home/deploy/travelWatamu/current/public;
index index.html index.htm;
location / {
passenger_base_uri /;
passenger_app_root /home/deploy/travelWatamu/current;
#try_files $uri $uri/ =404;
passenger_enabled on;
passenger_ruby /home/deploy/.rvm/gems/ruby-2.5.0/wrappers/ruby;
}
#Optional ssl certs
listen 443 ssl; # managed by Certbot
ssl_certificate /path_to_cert; # managed by Certbot
ssl_certificate_key /path_to_cert.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
if ($scheme != "https") {
return 301 https://$host$request_uri;
} # managed by Certbot
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment