安装步骤
tar zxf lnmp1.4.tar.gz
cd lnmp1.4
source install.sh
安装时间最长需要几个小时,网速决定。安装完成后,内容在/usr/local
。
Nginx 的配置文件:/usr/local/nginx/conf/nginx.conf
。
PHP7 的配置文件:/usr/local/php/etc/php.ini
。
配置 PathInfo
nginx.conf
中配置:
server
{
listen 80 default_server;
#listen [::]:80 default_server ipv6only=on;
server_name www.lnmp.org;
index index.html index.htm index.php;
root /home/wwwroot/default;
#error_page 404 /404.html;
include enable-php-pathinfo.conf;
location /nginx_status
{
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /\.
{
deny all;
}
access_log /home/wwwlogs/access.log;
error_log /home/wwwlogs/error.log error;
}
include vhost/*.conf;
}
enable-php-pathinfo.conf
配置内容:
location ~ [^/]\.php(/|$)
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
try_files $fastcgi_script_name =404;
include fastcgi.conf;
}