Skip to content

Instantly share code, notes, and snippets.

@kidach1
Created April 23, 2014 14:23
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 kidach1/11217194 to your computer and use it in GitHub Desktop.
Save kidach1/11217194 to your computer and use it in GitHub Desktop.
Nginx導入時、サクッと対応しておくと良いかもしれない ref: http://qiita.com/kidachi_/items/985efebba639713c562e
geo $allow_ip {
default 0;
93.184.216.119 1; # 自社IP
xx.xxx.xxx.xxx 1; # 支社IP1
yy.yyy.yyy.yyy 1; # 支社IP2
}
$ service crond status
crond は停止しています
$ sudo service crond start
crond を起動中: [ OK ]
server{
~
location ~ .*\.(html?|jpe?g|gif|png|css|js|ico|woff) {
expires 10d;
access_log off;
}
}
$ service crond status
crond は停止しています
$ sudo service crond start
crond を起動中: [ OK ]
$ service crond status
crond は停止しています
$ sudo service crond start
crond を起動中: [ OK ]
$ service crond status
crond は停止しています
$ sudo service crond start
crond を起動中: [ OK ]
[root@localhost ~]# cat /usr/share/nginx/html/index.html
Not Found
http {
server_tokens off;
~
server {
~
location /favicon {
empty_gif;
access_log off;
log_not_found off;
}
}
upstream sample_app_443 {
server unix:/tmp/unicorn.sock;
}
server{
~
# SSL対応したいページはそのままsample_app_443へ。
location ~ ^/user/info {
proxy_pass http://sample_app_443;
break;
}
# その他ページはHTTP(80)へrewrite。
location ~* / {
rewrite ^(.*) http://$http_host$1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment