您的位置:首页 > 运维架构 > Nginx

nginx的nginx.conf的配置文件修改

2017-03-30 13:23 501 查看
nginx的nginx.conf的配置文件修改

提示:
1. user  www; //需要在当前服务器下创建www的一个用户。
2. 需要在 /usr/local/nginx/logs下面同时存在,以下文件
access.log  error.log  nginx.pid  www.log

//==============配置文件开始====================//
user  www;
worker_processes  8;

error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        logs/nginx.pid;

events {
worker_connections  2048;
}

http {
include       mime.types;
default_type  application/octet-stream;
sendfile        on;
keepalive_timeout  65;
server {
listen       80;
server_name  127.0.0.1;

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location /{
root          /WebRoot/cmy;
index         index.php;
if (-f $request_filename) {
expires max;
break;
}
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
}

}

location ~ ^(.+\.php|.+\.html)(.*)$ {
root      /WebRoot/cmy;
fastcgi_index    index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param    SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param    PATH_INFO          $fastcgi_path_info;
fastcgi_param    PATH_TRANSLATED    $document_root$fastcgi_path_info;
fastcgi_pass    127.0.0.1:9000;
include    fastcgi.conf;
if ($request !~* HEAD(.*)$){
#                       access_log  logs/www.log  new_log;
}
# auth_basic "please enter password";
# auth_basic_user_file  /chinasofti/server/nginx/conf/vhosts/nginx_adminpasswd.pl;
}

#location ~ \.php$ {
#root           /WebRoot/cmy;
#fastcgi_pass   127.0.0.1:9000;
#index          index.php,index.html;
#try_files $uri $uri/ /index.php?s=$uri;
#fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
#  #include        fastcgi_params;
#include        fastcgi.conf;
#}

}
}
//==============配置文件结束====================//
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  nginx 服务器