Last active
December 29, 2015 12:39
-
-
Save y0t4/7671868 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
# /etc/nginx/conf.d/default.conf | |
upstream backend { | |
server 127.0.0.1:8080; | |
} | |
server { | |
listen 80; | |
server_name localhost; | |
root /home/csf/wordpress; | |
index index.html index.htm index.php; | |
keepalive_timeout 300; | |
location /favicon.ico { | |
log_not_found off; | |
access_log off; | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root /usr/share/nginx/html; | |
} | |
location /wp-comments-post.php { | |
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
fastcgi_pass_header "X-Accel-Redirect"; | |
fastcgi_pass_header "X-Accel-Expires"; | |
} | |
location / { | |
set $do_not_cache 0; | |
if ($uri ~* "\.php$") { | |
set $do_not_cache 1; | |
} | |
if ($is_args != "") { | |
set $do_not_cache 1; | |
} | |
proxy_no_cache $do_not_cache; | |
proxy_cache_bypass $do_not_cache; | |
proxy_pass http://backend; | |
proxy_cache zone; | |
proxy_cache_key $scheme$proxy_host$uri$is_args$args; | |
proxy_cache_valid 200 1h; | |
} | |
location /wp-admin { | |
proxy_pass http://backend; | |
} | |
location /wp-login.php { | |
proxy_pass http://backend; | |
} | |
} | |
server { | |
listen 8080; | |
server_name _; | |
root /home/csf/wordpress; | |
index index.php index.html; | |
charset utf-8; | |
keepalive_timeout 300; | |
access_log /var/log/nginx/fastcgi_log combined; | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires 24h; | |
log_not_found off; | |
} | |
location ~ \.php$ { | |
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
fastcgi_pass_header "X-Accel-Redirect"; | |
fastcgi_pass_header "X-Accel-Expires"; | |
} | |
} |
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/sysconfig/ipvsadm | |
-A -t 10.2.1.185:80 -s rr | |
-a -t 10.2.1.185:80 -r 10.2.1.208:80 -g -w 1 | |
-a -t 10.2.1.185:80 -r 10.2.1.227:80 -g -w 1 | |
-a -t 10.2.1.185:80 -r 10.2.2.94:80 -g -w 1 | |
-a -t 10.2.1.185:80 -r 127.0.0.1:80 -g -w 1 |
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/my.cnf | |
[mysqld] | |
federated=1 | |
character-set-server = utf8 | |
datadir=/var/lib/mysql | |
socket=/var/lib/mysql/mysql.sock | |
symbolic-links=0 | |
innodb_log_buffer_size = 1G | |
key_buffer_size = 12M | |
thread_cache_size=3000 | |
wait_timeout=300 | |
max_connections=1024 | |
query_cache_size=1024 | |
table_open_cache=3000 | |
connect_timeout=300 | |
net_read_timeout=300 | |
net_write_timeout=300 | |
innodb_change_buffering=inserts | |
sync_binlog=0 | |
innodb_flush_log_at_trx_commit=0 | |
innodb_io_capacity=5000 | |
innodb_read_io_threads=64 | |
innodb_write_io_threads=64 |
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/nginx.conf | |
user nginx; | |
worker_processes auto; | |
worker_rlimit_nofile 8192; | |
error_log /var/log/nginx/error.log warn; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 2048; | |
} | |
http { | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |
'$status $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for"'; | |
access_log /var/log/nginx/access.log main; | |
sendfile on; | |
keepalive_timeout 65; | |
gzip on; | |
gzip_types text/plain text/css application/json; | |
proxy_cache_path /var/cache/nginx/cache levels=1 keys_zone=zone:128m inactive=7d max_size=256m; | |
include /etc/nginx/conf.d/*.conf; | |
} |
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/php-fpm.d/www.conf | |
[www] | |
listen = /var/run/php-fpm/php-fpm.sock | |
listen.allowed_clients = 127.0.0.1 | |
user = nginx | |
group = nginx | |
pm = static | |
pm.max_children = 150 | |
pm.start_servers = 15 | |
pm.min_spare_servers = 5 | |
pm.max_spare_servers = 150 | |
request_terminate_timeout = 10 | |
slowlog = /var/log/php-fpm/www-slow.log | |
php_admin_value[error_log] = /var/log/php-fpm/www-error.log | |
php_admin_flag[log_errors] = on | |
php_value[session.save_handler] = files | |
php_value[session.save_path] = /var/lib/php/session |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment