1.安装前准备:
1.1.卸载NGINX
sudo apt-get remove nginx nginx-common # 卸载删除除了配置文件以外的所有文件。
sudo apt-get purge nginx nginx-common # 卸载所有东东,包括删除配置文件。
sudo apt-get autoremove # 在上面命令结束后执行,主要是卸载删除Nginx的不再被使用的依赖包。
sudo apt-get remove nginx-full nginx-common #卸载删除两个主要的包。
sudo service nginx restart #重启nginx
ps aux|grep nginx
1.2.卸载PHP
#卸载PHP5.X
sudo apt-get --purge remove php5* libapache2-mod-php5
sudo apt-get autoremove php5
运行安装lnmp1.7(https://www.lnmp.org):
wget http://soft.vpser.net/lnmp/lnmp1.7.tar.gz -cO lnmp1.7.tar.gz && tar zxf lnmp1.7.tar.gz && cd lnmp1.7 && ./install.sh lnmp
选择需要安装的软件版本,参考:
@see: https://www.lnmp.org/install.html
等待半小时左右可知安装成功:
============================== Check install ==============================
Checking ...
Nginx: OK
Do not install MySQL/MariaDB.
PHP: OK
PHP-FPM: OK
Clean Web Server src directory...
+------------------------------------------------------------------------+
| LNMP V1.7 for Ubuntu Linux Server, Written by Licess |
+------------------------------------------------------------------------+
| For more information please visit https://lnmp.org |
+------------------------------------------------------------------------+
| lnmp status manage: lnmp {start|stop|reload|restart|kill|status} |
+------------------------------------------------------------------------+
| phpMyAdmin: http://IP/phpmyadmin/ |
| phpinfo: http://IP/phpinfo.php |
| Prober: http://IP/p.php |
+------------------------------------------------------------------------+
| Add VirtualHost: lnmp vhost add |
+------------------------------------------------------------------------+
| Default directory: /home/wwwroot/default |
+------------------------------------------------------------------------+
+-------------------------------------------+
| Manager for LNMP, Written by Licess |
+-------------------------------------------+
| https://lnmp.org |
+-------------------------------------------+
nginx (pid 30075) is running...
php-fpm is runing!
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:50291 *:*
LISTEN 0 128 *:60437 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 128 *:49471 *:*
LISTEN 0 64 *:41728 *:*
LISTEN 0 64 *:2049 *:*
LISTEN 0 64 *:39108 *:*
LISTEN 0 128 *:54636 *:*
LISTEN 0 128 *:111 *:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 :::59795 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 5 :::4118 :::*
LISTEN 0 64 :::36959 :::*
LISTEN 0 64 :::2049 :::*
LISTEN 0 128 :::34082 :::*
LISTEN 0 128 :::41546 :::*
LISTEN 0 64 :::38252 :::*
LISTEN 0 128 :::51981 :::*
LISTEN 0 128 :::111 :::*
Install lnmp takes 22 minutes.
Install lnmp V1.7 completed! enjoy it.
最后删除/wwwroot/default下目录内容(出于安全考虑)。
FAQ:
- PHP在运行中发现一个奇怪的问题,require_once无法加载上级目录php文件,研究后明白这是fastcgi的一个默认配置,如需支持将/usr/local/nginx/conf/fastcgi.cong下面这段内容注释,否则require无法引入上级目录的文件
#fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";