4 min Soupmode nginx config soupmode nginx config as of dec 17, 2013 user ghost; worker_processes 4; pid /run/nginx.pid; events { worker_connections 768; multi_accept on; } http { proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m; proxy_temp_path /var/tmp; include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; gzip on; gzip_comp_level 6; gzip_vary on; gzip_min_length 1000; gzip_proxied any; gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; gzip_buffers 16 8k; upstream ghost_upstream { server 127.0.0.1:2368; keepalive 64; } ########## # GHOST ########## server { listen 80; server_name blog.soupmode.com; # If you dont want it forcing users to www.YOUR_DOMAIN then you need to remove this code. # if ($host = 'soupmode.com' ) { # rewrite ^/(.*)$ http://www.soupmode.com/$1 permanent; # } # location ~ ^/(ghost/signup/) { # rewrite ^/(.*)$ http://soupmode.com/ permanent; # } location ~ ^/(img/|css/|lib/|vendor/|fonts/|robots.txt|humans.txt) { root /home/ghost/core/client/assets; access_log off; expires max; } location ~ ^/(shared/|built/) { root /home/ghost/core; access_log off; expires max; } location ~ ^/(favicon.ico) { root /home/ghost/core/shared; access_log off; expires max; } location ~ ^/(content/images/) { root /home/ghost; access_log off; expires max; } location / { proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_set_header Connection ""; proxy_http_version 1.1; proxy_cache one; proxy_cache_key ghost$request_uri$scheme; proxy_pass http://ghost_upstream; } } ########## # JUNCO ########## server { listen 80; ## listen for ipv4; this line is default and implied #listen [::]:80 default ipv6only=on; ## listen for ipv6 # root /home/junco/html; # Make site accessible from http://localhost/ server_name junco.soupmode.com; location ~ ^/(css/|javascript/) { root /home/junco/html; access_log off; expires max; } location ~ \.pl|cgi$ { root /home/junco; # try_files $uri =404; gzip off; fastcgi_pass 127.0.0.1:8999; fastcgi_index index.pl; fastcgi_split_path_info ^((?U).+\.pl)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params; } location / { # rewrite ^/(.*)$ http://junco.soupmode.com/cgi-bin/junco.pl permanent; # return 301 http://junco.soupmode.com/cgi-bin/junco.pl; root /home/junco/html; index junco.pl; rewrite ^/(.*)$ /junco.pl break; fastcgi_pass 127.0.0.1:8999; fastcgi_index junco.pl; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } ########## # KINGLET ########## server { listen 80; ## listen for ipv4; this line is default and implied #listen [::]:80 default ipv6only=on; ## listen for ipv6 # Make site accessible from http://localhost/ server_name kinglet.soupmode.com; location ~ ^/(css/|javascript/) { root /home/kinglet/Kinglet/root; access_log off; expires max; } location /api/v1 { root /home/kinglet/Kinglet/root/api/v1; index kingletapi.pl; rewrite ^/(.*)$ /kingletapi.pl?query=$1 break; fastcgi_pass 127.0.0.1:8999; fastcgi_index kingletapi.pl; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location / { root /home/kinglet/Kinglet/root; # rewrite ^/(.*)$ http://kinglet.soupmode.com/index.pl/$1 permanent; index kinglet.pl; rewrite ^/(.*)$ /kinglet.pl?query=$1 break; fastcgi_pass 127.0.0.1:8999; fastcgi_index kinglet.pl; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # location ~ \.pl|cgi$ { # gzip off; # fastcgi_pass 127.0.0.1:8999; # fastcgi_index index.pl; # include fastcgi_params; # fastcgi_split_path_info ^((?U).+\.pl)(/?.+)$; # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # fastcgi_param PATH_INFO $fastcgi_path_info; # fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; # } } ########## # API for Kinglet ########## server { listen 80; ## listen for ipv4; this line is default and implied server_name api.soupmode.com; location / { root /home/kinglet/Kinglet/root; include fastcgi_params; index kingletapi.pl; rewrite ^/(.*)$ /kingletapi.pl?query=$1 break; fastcgi_pass 127.0.0.1:8999; fastcgi_index kingletapi.pl; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } } ########## # SOUPMODE Default ########## server { listen 80; ## listen for ipv4; this line is default and implied #listen [::]:80 default ipv6only=on; ## listen for ipv6 # Make site accessible from http://localhost/ server_name soupmode.com www.soupmode.com; location ~ ^/(css/|javascript/) { root /home/kinglet/Kinglet/root; access_log off; expires max; } location /api/v1 { root /home/kinglet/Kinglet/root/api/v1; index kingletapi.pl; rewrite ^/(.*)$ /kingletapi.pl?query=$1 break; fastcgi_pass 127.0.0.1:8999; fastcgi_index kingletapi.pl; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location / { root /home/kinglet/Kinglet/root; # rewrite ^/(.*)$ http://soupmode.com/index.pl/$1 permanent; index kinglet.pl; rewrite ^/(.*)$ /kinglet.pl?query=$1 break; fastcgi_pass 127.0.0.1:8999; fastcgi_index kinglet.pl; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } # oring soupmode default confg prior to 15dec2013 # server { # listen 80; ## listen for ipv4; this line is default and implied #listen [::]:80 default ipv6only=on; ## listen for ipv6 # root /home/soupmode/default; # index index.html index.htm; # Make site accessible from http://localhost/ # server_name soupmode.com www.soupmode.com; # location / { # First attempt to serve request as file, then # as directory, then fall back to index.html # try_files $uri $uri/ /index.html; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules # } #} ########## # Testcode ########## server { listen 80; ## listen for ipv4; this line is default and implied #listen [::]:80 default ipv6only=on; ## listen for ipv6 root /home/testcode/html; index index.html index.htm; # Make site accessible from http://localhost/ server_name testcode.soupmode.com; location ~ ^/(css/|javascript/) { root /home/testcode/html; access_log off; expires max; } location ~ \.pl|cgi$ { root /home/testcode; # try_files $uri =404; gzip off; fastcgi_pass 127.0.0.1:8999; fastcgi_index index.pl; fastcgi_split_path_info ^((?U).+\.pl)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params; } } access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } From JR's : articles 746 words - 8971 chars - 4 min read created on Nov 15, 2013 at 03:30:05 pm updated on Dec 17, 2013 at 05:01:44 pm - # source - versions - backlinks