php部署

68 阅读1分钟

部署php7.4 和最新的nginx

错误日志在这里 /var/opt/remi/php74/log/php-fpm/error.log

/etc/nginx/conf.d/default.conf

server {
    listen    80;
    server_name  www.xxxx.top; 
 
   root   /opt/data/payment/;   
   index index.php index.html index.htm;
    location ~ .php$ {
        try_files $uri =404;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

/etc/opt/remi/php74/php-fpm.d/www.conf 这里什么都不用改

这里有日志 /var/log/nginx /var/opt/remi/php74/log/php-fpm

切记切记 删除 ini.user文件

给日志权限 /opt/data/groupSystem/runtime/log

后面给runtime递归777

由于nginx不同意apache 需要增加pathinfo支持 具体可以查 php nginx pathinfo 会有很多资料

server {
    listen 80;
    server_name aec.xxxx.top;    #需要修改客户端hosts文件
    root /opt/data/groupSystem/; 
    index index.php index.html index.htm;
    location ~ \.php {
        try_files $uri =404;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        set $path_info "";
	   set $real_script_name $fastcgi_script_name;
	   if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
	    set $real_script_name $1;
	    set $path_info $2;
	   }
	  fastcgi_param PATH_INFO       $path_info;
	  fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
	  fastcgi_param SCRIPT_NAME     $real_script_name;
}
}

aec.xxxx.top/index.php/website/index/login.html 一直报404 将

    location ~ .php$ {

改成

location ~ .php {

就好了