nginx配置文件:
------------------
# 操作系统启动Nginx这个进程是主进程,用户为root, # 主进程再启动进程,称为子进程或工作进程 # 启动子进程的默认用户 #user nobody; # 一个主进程和多个工作进程,工作进程是单进程多线程的。这里定义的是工作进程数量,有几个核就写几个 worker_processes 1; # 全局错误日志,日志级别和格式 #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; # 定义主进程号文件位置,放的主进程号cat logs/nginx.pid #pid logs/nginx.pid; events { # 每个工作进程最大的并发数 worker_connections 1024; } # http服务器设置 http { # 设定mime类型,类型由mine.type文件定义 include 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"'; # $remote_addr与$http_x_forwarded_for:用于记录客户端的ip地址; # $remote_user:用来记录客户端用户名称; # $time_local:用来记录访问时间与时区; # $request:用来记录请求的url与http协议; # $status: 用来记录请求状态;成功是200 # $body_bytes_sent:记录发送给客户端文件主体内容大小; # $http_referer:用来记录从哪个页面链接访问过来的; # $http_user_agent:记录客户浏览器的相关信息; # 全局访问日志路径 #access_log logs/access.log main; # 对于普通应用必须设置为on,略 sendfile on; # 此选项仅在使用sendfile时使用,略 #tcp_nopush on; # 长连接超时时间,减少三次握手次数 #keepalive_timeout 0; keepalive_timeout 65; # 开启压缩 #gzip on; # 配置虚拟主机,一个server就可以发布一个网站 server { # 虚拟主机使用的端口 listen 80; # 虚拟主机域名 server_name localhost; # 虚拟主机支持的字符集 #charset koi8-r; # 虚拟主机的访问日志路径 #access_log logs/host.access.log main; # 定义web根路径 location / { # 根路径目录 root html; # 索引页 index index.html index.htm; } #error_page 404 /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; } # 定义反向代理服务器 数据服务器是lamp模型 # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ .php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ .php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }
12213