Nginx配置文件参数

来源:互联网 发布:人工智能湖南论坛 编辑:程序博客网 时间:2024/06/16 17:22
#设定虚拟主机配置    server {        #侦听80端口        listen    80;        #定义使用 www.nginx.cn访问        server_name  www.nginx.cn;         #定义服务器的默认网站根目录位置        root html;         #设定本虚拟主机的访问日志        access_log  logs/nginx.access.log  main;         #默认请求        location / {                        #定义首页索引文件的名称            index index.php index.html index.htm;            }         # 定义错误提示页面        error_page   500 502 503 504 /50x.html;        location = /50x.html {        }         #静态文件,nginx自己处理        location ~ ^/(images|javascript|js|css|flash|media|static)/ {                        #过期30天,静态文件不怎么更新,过期可以设大一点,            #如果频繁更新,则可以设置得小一点。            expires 30d;        }         #PHP 脚本请求全部转发到 FastCGI处理. 使用FastCGI默认配置.        location ~ .php$ {            fastcgi_pass 127.0.0.1:9000;            fastcgi_index index.php;            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;            include fastcgi_params;        }         #禁止访问 .htxxx 文件            location ~ /.ht {            deny all;        }     }
 简易配置  server {
        listen       80;        server_name www.siye.so;        index index.html index.htm index.php;        root  /home/wwwroot/postlog/public;location ~ .*\.(php|php5)?$ {    fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;            fastcgi_param  SCRIPT_NAME $fastcgi_script_name;include fastcgi_params; }# 根据laravel规则进行url重写if (!-e $request_filename)        {   rewrite ^/(.*)$ /index.php?/$1 last;   break;        }}
原创粉丝点击