Centos7--lnmp+jemalloc优化nginx与mysql
# ln -s /usr/local/nginx/sbin/nginx /usr/sbin/nginx# mkdir /website
# chown -R nginx:nginx /website/
# vim /usr/local/nginx/conf/nginx.conf
usernginx nginx;
worker_processesauto;
error_loglogs/error.logerror;
pid /run/nginx.pid;
events {
use epoll;
worker_connections65535;
}
http {
include mime.types;
default_typeapplication/octet-stream;
log_formatmain'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
tcp_nopush on;
tcp_nodelay on;
#keepalive_timeout0;
keepalive_timeout65;
gzipon;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/ application/x- text/ text/css application/xml application/xml+rss;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE \.";
server {
listen 80;
server_nameoslinux.cn;
charset UTF-8;
location / {
root /website;
indexindex.html index.htm index.php;
}
location /NginxStatus {
stub_status on; #启用StubStatus的工作状态统计功能*/
access_log logs/NginxStatus.log; #/*StubStatus模块的访问日志文件*/
auth_basic "NginxStatus"; #/*StubStatus的一种认证机制*/
}
#error_page404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504/50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
root /website;
fastcgi_pass 127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAME/website$fastcgi_script_name;
include fastcgi_params;
}
}
}
# nginx -s reload
页:
[1]