1.删除Apache@H_403_1@
sudo service apache2 stop
update-rc.d -f apache2 remove
sudo apt-get remove apache2
sudo service apache2 stop
update-rc.d -f apache2 remove
sudo apt-get remove apache2
删除完之后,更新一下包列表sudo apt-get update
2.Nginx@H_403_1@
安装
sudo apt-get install Nginx
使用
sudo service Nginx start //启动
sudo service Nginx restart //重启
sudo service Nginx status //查看状态
安装
sudo apt-get install Nginx
使用
sudo service Nginx start //启动
sudo service Nginx restart //重启
sudo service Nginx status //查看状态
在浏览器地址栏输入公网IP,你就可以看的welcome to Nginx的界面了
3.PHP@H_403_1@
安装
sudo apt-get install PHP5-fpm PHP5-cli PHP5-mcrypt
配置
sudo vim /etc/PHP5/fpm/PHP.ini
//打开PHP配置文件,找到cgi.fix_pathinfo选项,去掉它前面的注释分号;,然后将它的值设置为0,如下
cgi.fix_pathinfo=0
5.启用PHP5-mcrypt:
sudo PHP5enmod mcrypt
6.重启PHP5-fpm:
sudo service PHP5-fpm restart
在搭建完LEMP环境之后,首先要明确两个重要目录
/usr/share/Nginx/html
Nginx的服务器配置文件所在目录
/etc/Nginx/sites-available/
安装
sudo apt-get install PHP5-fpm PHP5-cli PHP5-mcrypt
配置
sudo vim /etc/PHP5/fpm/PHP.ini
//打开PHP配置文件,找到cgi.fix_pathinfo选项,去掉它前面的注释分号;,然后将它的值设置为0,如下
cgi.fix_pathinfo=0
5.启用PHP5-mcrypt:
sudo PHP5enmod mcrypt
6.重启PHP5-fpm:
sudo service PHP5-fpm restart
在搭建完LEMP环境之后,首先要明确两个重要目录
/usr/share/Nginx/html
Nginx的服务器配置文件所在目录
/etc/Nginx/sites-available/
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/jiajiao-web-test/;
index index.PHP index.html index.htm;
Make site accessible from http://localhost/
server_name jiajiaodaojia.cn;
location / {
root /var/www/jiajiao-web-test/;
# First attempt to serve request as file,then
# as directory,then fall back to index.html
try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/<a href="https://www.jb51.cc/tag/Nginx/" target="_blank" class="keywords">Nginx</a>/naxsi.rules
if (!-e $request_filename)
{
rewrite ^/<a href="https://www.jb51.cc/tag/PHP/" target="_blank" class="keywords">PHP</a>Parser/(.*)$ /<a href="https://www.jb51.cc/tag/PHP/" target="_blank" class="keywords">PHP</a>Parser/index.<a href="https://www.jb51.cc/tag/PHP/" target="_blank" class="keywords">PHP</a>?s=$1 last;
break;
}
# First attempt to serve request as file,then fall back to displaying a <a href="https://www.jb51.cc/tag/404/" target="_blank" class="keywords">404</a>.
# NOTE: You should have "cgi.fix_pathinfo = 0;" in PHP.ini
# With PHP5-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With PHP5-fpm:
# Uncomment to enable naxsi on this location
# include /etc/<a href="https://www.jb51.cc/tag/Nginx/" target="_blank" class="keywords">Nginx</a>/naxsi.rules
}
location ~ \.PHP$ {
root /var/www/jiajiao-web-test/;
try_files $uri = 404;
fastcgi_split_path_info ^(.+\.PHP)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in PHP.ini
#
# # With PHP5-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.PHP)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
# # With PHP5-fpm:
原文链接:https://www.f2er.com/note/422614.html