Nginx配置直接php


nginx配置文件:

server {
    listen       80;
    server_name  localhost;

    access_log  /var/log/nginx/log/host.access.log  main; root /usr/share/nginx/html;  #原本这个设置是在下面localtion里面的

    location / {
        index  index.php index.html index.htm;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    location ~* \.php$ { fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;   fastcgi_param SCRIPT_NAME $fastcgi_script_name; }
}

php-fpm配置文件(注意:可能有些php版本不是这个文件,但只要意思到位即可):

vi /etc/php-fpm.d/www.conf

修改这两个地方为nginx用户

最后测试php页面:

<?php

phpinfo();

?>

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM