新网创想网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

配置nginx使之支持pathinfo-创新互联

phalcon项目,
oneinstack环境lnmp。
配置文件:
/usr/local/nginx/conf/vhost/dldh.ccc.conf
自动生成的。

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:主机域名虚拟主机、营销软件、网站建设、高陵网站维护、网站推广。

问题:
除首页外,其他都打不开,且样式文件也打不开。
http://dldh.ccc/index.php/back/css/bootstrap.min.css
http://dldh.ccc/index.php/backend/index/index
都报: Access denied.

解决办法:
作修改如下。


server {
  listen 80;
  server_name dldh.ccc;
  access_log off;
  index index.html index.htm index.php;
  root /web/dldh/public;

  try_files $uri $uri/ @rewrite; #增加这一句
                    location @rewrite{  #增加这一句
        rewrite ^/(.*)$ /index.php?_url=/$1; #增加这一句
  }

  #include /usr/local/nginx/conf/rewrite/none.conf;#注释这一句
  #error_page 404 /404.html;
  #error_page 502 /502.html;

  location ~ [^/]\.php(/|$) {
    #fastcgi_pass remote_php_ip:9000;
    fastcgi_pass unix:/dev/shm/php-cgi.sock;
    fastcgi_index index.php;
    include fastcgi.conf;
    fastcgi_split_path_info ^(.+\.php)(.*)$; #增加这一句
    fastcgi_param PATH_INFO $fastcgi_path_info; #增加这一句
  }

  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
    expires 30d;
    access_log off;
  }
  location ~ .*\.(js|css)?$ {
    expires 7d;
    access_log off;
  }
  location ~ /\.ht {
    deny all;
  }
}

参考:
nginx下支持PATH_INFO详解[1]
https://blog.csdn.net/hanzengyi/article/details/53483171
简单配置nginx使之支持pathinfo
https://www.cnblogs.com/kzfbk/p/7302623.html

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网站栏目:配置nginx使之支持pathinfo-创新互联
当前链接:http://www.wjwzjz.com/article/cseose.html
在线咨询
服务热线
服务热线:028-86922220
TOP