开发者社区> 问答> 正文

nginx站点的 conf文件支持rewrite写法问题

conf文件 红色部分是我添加的,是位置不对?还是写法有错误,就是不管用,求高手指导,谢谢了。(网址 文字是因为我是新手提交不了写成了文字)


server{
    listen 80;
    server_name vip.xxx.com;
    root /b/domains/vip.xxx.com/public_html;
    index index.php;



        error_page  404               /404.html;


     if (!-e $request_filename) {
     rewrite ^(.*)$ /index.php?s=/$1 last;
     }
     if ($host != 'vip. xxx .com' ) {  
       rewrite ^/(.*)$ 网址/$1 permanent;
     }
     error_page  404 网址;
    #Custom rules Start
        #Custom rules End
    location = /500.html {
        root   /usr/share/nginx/html;
    }


    location ~ \.php$ {
        fastcgi_pass   unix:/dev/shm/php.sock;
        include        fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        access_log     /a/apps/nginx/logs/vip.xxx.com.access.log main;
    }


    location ~ /\.ht {
        deny  all;
    }
}

展开
收起
yjphong 2017-04-13 02:42:55 2931 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
《Nginx 代理系统常用手册》 立即下载
CentOS Nginx PHP JAVA 多语言镜像使用手 立即下载
CentOS Nginx PHP JAVA多语言镜像使用手册 立即下载