Last active
October 13, 2015 01:28
-
-
Save hamecoded/4117649 to your computer and use it in GitHub Desktop.
configuring nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/etc/nginx/vhosts/app1.conf | |
upstream unicorn_app1 { | |
server unix:/home/user1/app1/shared/system/unicorn.sock; | |
} | |
server { | |
server_name domain.name.com, domain.name2.com; | |
# server_name _; | |
listen 80; | |
client_max_body_size 4G; | |
keepalive_timeout 5; | |
location /app1_relative_path/assets { | |
root /home/user1/app1/current/public; | |
rewrite ^/app1_relative_path(.*)$ /$1 break; | |
gzip_static on; | |
expires max; | |
add_header Cache-Control public; | |
#add_header Last-Modified ""; | |
add_header ETag ""; | |
} | |
location /app1_relative_path { | |
root /home/user1/app1/current/public; | |
access_log /var/log/nginx/unicorn_app1.access.log; | |
gzip_static on; | |
rewrite ^/app1_relative_path(.*)$ /$1 break; | |
try_files $uri @app1_proxy; | |
error_page 500 502 503 504 /500.html; | |
location = /app1_relative_path/500.html { | |
root /home/user1/app1/current/public; | |
} | |
} | |
location @app1_proxy { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
rewrite ^/app1_relative_path(.*)$ /$1; | |
proxy_pass http://unicorn_app1; | |
break; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/etc/nginx/vhosts/https_redirect.conf | |
server { | |
listen 80 default; | |
server_name ssl.domain.name.com; | |
rewrite ^(.*) https://$host$1 permanent; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#for setting up proxies on windows | |
server { | |
listen 8080; | |
server_name localhost; | |
location / { | |
proxy_pass http://localhost:9000; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
location /SaaS-Services { | |
proxy_pass http://localhost:8082; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/etc/nginx/vhosts/sslapp.conf | |
upstream unicorn_sslapp { | |
server unix:/home/user1/sslapp/shared/system/unicorn.sock fail_timeout=0; | |
} | |
server { | |
server_name ssl.domain.name.com; | |
listen 443 default ssl; | |
ssl_certificate /etc/waze/ssl/domain.name.com.crt.nginx; | |
ssl_certificate_key /etc/waze/ssl/domain.name.com.pem.nginx; | |
client_max_body_size 4G; | |
keepalive_timeout 5; | |
access_log /var/log/nginx/sslapp.access.log; | |
root /home/user1/sslapp/current/public; | |
location /sslapp_relative_path { | |
proxy_pass https://www.domain.name.com; | |
} | |
location / { | |
gzip_static on; | |
try_files $uri @proxy; | |
} | |
location @proxy { | |
include proxy.conf; | |
proxy_pass http://unicorn_sslapp; | |
break; | |
} | |
error_page 500 502 503 504 /500.html; | |
location = /500.html { | |
root /home/user1/sslapp/current/public; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment