lnmp下配置虚拟机,解决TP3跟TP5无法访问问题

lnmp下配置虚拟机,解决TP3跟TP5无法访问问题

2018-08-14修改:

在lnmp1.5下遇到问题,路径定到public目录中,出现500的问题

解决办法:将nginx配置目录中的  fastcgi.conf  配置文件 中的

1

fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";

  改成

1

fastcgi_param PHP_ADMIN_VALUE "open_basedir=/home/wwwroot/:/tmp/:/proc/";

  即可。

方法一、在配置文件中,将include enable-php.conf;替换为include enable-php-pathinfo.conf;

方法二、将虚拟主机中的配置文件替换如下,目录自行更改

server
    {
        listen 80;
        #listen [::]:80;
        server_name www.apiadmin.com;
        index index.html index.htm index.php default.html 
        default.htm default.php;
        root  /home/wwwroot/apiadmin/public/;
        location / {
          if (!-e $request_filename) {
           rewrite  ^(.*)$  /index.php?s=$1  last;
           break;
          }
       }
        location ~ \.php {
          #fastcgi_pass remote_php_ip:9000;
          fastcgi_pass unix:/tmp/php-cgi.sock;
          fastcgi_index index.php;
          include fastcgi_params;
          set $real_script_name $fastcgi_script_name;
          if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
              set $real_script_name $1;
              #set $path_info $2;
           }
        fastcgi_param SCRIPT_FILENAME     
        $document_root$real_script_name;
        fastcgi_param SCRIPT_NAME $real_script_name;
        #fastcgi_param PATH_INFO $path_info;
        }
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }
        access_log  /home/XXX/XXX.log;
    }
发布了37 篇原创文章 · 获赞 8 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/limingyue0312/article/details/89150281