nginx虚拟机的配置

user nginx nginx;
worker_processes 1;
pid /data/var/run/nginx/nginx.pid;
worker_rlimit_nofile 51200;

events
{
#epoll是多路复用IO中的一种方式
use epoll;
#单个后台的work process进行的最大并发链接数
worker_connections 51200;
}

http{
#设定mime类型,类型由mime.types文件定义
include mime.types;
default_type application/octet-stream;
#设置日志格式

#指定nginx是否调用sendfile来输出文件
sendfile on;

#连接超时时间
keepalive_timeout 60;
tcp_nodelay on;
#声明日志格式,请求的地址,状态,请求ip
log_format access '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';

#设置虚拟主机设置
server{
#侦听80端口
listen 80;
#定义访问域名
server_name lx.workplace.com;
#定义服务器的默认网站根目录位置
root /data/wwwroot/workplace;
#默认请求
location / {
#定义首页索引文件名称
index index.php index.html index.htm;
}

#设置php脚本请求全部转发到fastcgi处理
location ~ .php$ {
#fastcgi端口
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi路径
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#设置日志
access_log /data/wwwlogs/admin.njw88.com/access.log;
error_log /data/wwwlogs/admin.njw88.com/error.log;
}
}

原文地址:https://www.cnblogs.com/lisqiong/p/5524668.html