Last active
January 27, 2016 01:23
-
-
Save totzyuta/d3b4eeaf86c5c5b58ba1 to your computer and use it in GitHub Desktop.
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
upstream unicorn_server { | |
server unix:/tmp/unicorn.sock | |
fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name 1-box.jp; | |
access_log /var/log/nginx/access.log; | |
error_log /var/log/nginx/error.log; | |
location / { | |
return 301 https://$host$request_uri; | |
} | |
location ^~ /wordpress { | |
root /var/www/wordpress; | |
index index.php; | |
try_files $uri $uri/ /wordpress/index.php?q=$uri&$args; | |
location ~/wp-admin$ { | |
rewrite /wp-admin$ $scheme://$host$uri/ permanent; | |
} | |
location ~ /files/$ { | |
rewrite /files/$ index.php last; | |
} | |
location ~ \.php$ { | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME /var/www/wordpress$fastcgi_script_name; | |
fastcgi_param PATH_INFO $fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} | |
} | |
server { | |
listen 443 ssl; | |
ssl_certificate /etc/nginx/ssl.crt; | |
ssl_certificate_key /etc/nginx/ssl.jp.key; | |
server_name example.com; | |
client_max_body_size 4G; | |
# keepalive_timeout 5; | |
root /var/www/app/current/public; | |
access_log /var/log/nginx/app/access.log; | |
error_log /var/log/nginx/app/error.log; | |
error_page 500 502 503 504 /500.html; | |
try_files $uri/index.html $uri @unicorn; | |
location @unicorn { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_pass http://unicorn_server; | |
} | |
location ~ ^/assets/ { | |
root /var/www/app/current/public; | |
} | |
error_page 500 502 503 504 /500.html; | |
location = /500.html { | |
root /var/www/app/current/public; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment