软件版本
- nginx 1.12
- mysql 5.7
- php 7.2
- redis 3.2
- laravel 5.5
lnmp安装
通过lnmp.org直接安装nginx+mysql+php
网站配置
安装完成后,软件目录/usr/local
,网站默认目录/home/wwwroot
通过在/usr/local/nginx/conf/vhost
中添加vhost,设置laravel应用,具体内容如下
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;
}
需要注意的是默认的include enable-php-pathinfo.conf;
这一行一定要注释掉,并且使用上面的配置来指定fast-cgi的运行方式,否则会报500错误。
最后运行即可。
网友评论