再分享一个优化过的生产环境nginx配置

作者:linux120 发布时间:November 21, 2013 分类:服务器配置

user www-data;
pid /var/run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 100000;

events {
worker_connections 2048;
multi_accept on;
use epoll;
}

http {
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;

access_log off;
error_log /var/log/nginx/error.log crit;

keepalive_timeout 10;
client_header_timeout 10;
client_body_timeout 10;
reset_timedout_connection on;
send_timeout 10;

limit_conn_zone $binary_remote_addr zone=addr:5m;
limit_conn addr 100;

include /etc/nginx/mime.types;
default_type text/html;
charset UTF-8;

gzip on;
gzip_disable "msie6";
gzip_proxied any;
gzip_min_length 1000;
gzip_comp_level 6;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

open_file_cache max=100000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

分享一下扬帆Nginx+PHP的正确配置档

作者:linux120 发布时间:November 19, 2013 分类:服务器配置

server {
listen 80;
server_name foo.com;

root /path;
index index.html index.htm index.php;

location / {
try_files $uri $uri/ /index.php;
}

location ~ \.php$ {
try_files $uri =404;

include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
}
}

网上其他拷贝来拷贝去的都是源自s135的配置,过时且不合语法不够安全,用这个吧。。。

Discuz!x2.5 Upload Error:413错误解决

作者:linux120 发布时间:November 4, 2013 分类:服务器维护

因网站访问量越来越大,需要采取动静态分离,应客户需求将前端的Apache替换成Nginx,具体前后端转换过程不细表了,转完后在上传1M以上的附件时发生413错误。
解决方法如下:

vi /linux120/nginx/etc/ngnix.conf
#在ngnix.conf在http { }中加入以下代码
client_max_body_size 10m;

重启nginx即解决。