軟件版本
- nginx 1.12
- mysql 5.7
- php 7.2
- redis 3.2
- laravel 5.5
lnmp安裝
通過lnmp.org直接安裝nginx+mysql+php
網(wǎng)站配置
安裝完成后,軟件目錄/usr/local,網(wǎng)站默認(rèn)目錄/home/wwwroot
通過在/usr/local/nginx/conf/vhost中添加vhost,設(shè)置laravel應(yīng)用,具體內(nèi)容如下
server
{
listen 80;
#listen [::]:80;
server_name .tax.com ;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/tax/public;
include rewrite/laravel.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
# include enable-php-pathinfo.conf;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
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/taxation.beke-off.lianjia.com.log;
error_log /home/wwwlogs/error-tax.log;
}
需要注意的是默認(rèn)的include enable-php-pathinfo.conf;這一行一定要注釋掉,并且使用上面的配置來指定fast-cgi的運(yùn)行方式,否則會(huì)報(bào)500錯(cuò)誤。
最后運(yùn)行即可。