一、安装php7.2
https://www.cnblogs.com/rxbook/p/9106513.html
二、配置laravel环境(public目录下)
lnmp:使lnmp一键安装包
.conf配置添加:
location ~ [^/].php(/|$) { try_files $uri =404; fastcgi_pass unix:/tmp/php-cgi7.3.sock; fastcgi_index index.php; include fastcgi.conf; fastcgi_param PHP_ADMIN_VALUE "open_basedir=/mnt/hgfs/linuxShare/HotelAPI/../:/tmp/:/proc/"; }
其中:
另外:解决首页正常访问 其他页面404
location / { try_files $uri $uri/ /index.php?$query_string; }
完整的配置:
server { listen 80; #listen [::]:80; server_name lc.hotelapi.com; index index.html index.htm index.php default.html default.htm default.php; root /mnt/hgfs/linuxShare/HotelAPI/public; include rewrite/other.conf; #error_page 404 /404.html; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ [^/].php(/|$) { try_files $uri =404; fastcgi_pass unix:/tmp/php-cgi7.3.sock; fastcgi_index index.php; include fastcgi.conf; fastcgi_param PHP_ADMIN_VALUE "open_basedir=/mnt/hgfs/linuxShare/HotelAPI/../:/tmp/:/proc/"; } # Deny access to PHP files in specific directory #location ~ /(wp-content|uploads|wp-includes|images)/.*.php$ { deny all; } # include enable-php-pathinfo.conf; include enable-php7.3.conf; location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*.(js|css)?$ { expires 12h; } location ~ /.well-known { allow all; } location ~ /. { deny all; } access_log /home/wwwlogs/lc.laravel-demo.com.log; }