nginx域名解析
未十一

伪静态(去掉index.php):

在配置文件相应域名添加:
if (!-e $request_filename) {
      rewrite ^(.*)$ /index.php$1 last;
 }

绑定域名:(nginx/conf/vhosts.conf)

server{
    listen  80;
    server_name  shengle.me;
    root  "D:/phpStudy/WWW/shengle";
    #伪静态
    if (!-e $request_filename) {
        #地址作为将参数rewrite到index.php上。/加不加index.php都可以访问
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
        rewrite ^(.*)$ /index.php?s=$1 last;
    }
    location / {
        index  index.php;
        autoindex  off;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
    location ~ \.php(.*)$  {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_split_path_info  ^((?U).+\.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;
        include        fastcgi_params;
    }
}

发布于 2018-12-23 10:40:52

{{ comment.username }}

{{ comment.created_format }}

{{ reply.username }}

回复

{{ reply.to_username }}:

{{ reply.created_format }}