计算机网络/计算机科学与应用/系统/运维/开发

Nginx解析PHP文件配置


server {
   listen  80;
   server_name _;
   location / {
      root  html/myphp;
      index index.php  index.html;
   }
   # 添加有关php程序的解析
   # 判断当请求url结尾是以php,php5的时候,就进入如下的location代码
   location ~ .*\.(php|php5)?$ {
      root html/myphp;
      # 将进入到该location内的uri请求看做是cgi程序,并将请求发送到9000端口,交由php-fpm处理
      fastcgi_pass 127.0.0.1:9000;
      fastcgi_index  index.php;
      include fastcgi.conf;
   }
}


人生活在得失之间,得亦是失,失亦是得。

评论

^