ubuntu16.04 configuration lnmp environment

Finally good domain name for the record, emmmmmm, you can set up a blog!

Reference to some blog:
1. https://www.cnblogs.com/zhangbobo/p/9597446.html
2. https://segmentfault.com/a/1190000016777859?utm_source=tag-newest
3. HTTPS: // the WWW .cnblogs.com / mracale / p / 9632714.html
thank these bloggers blog!

nginx multi-site configuration

Please move to: https://blog.csdn.net/HKer_YM/article/details/93762220

  • First, you have to take a day server, just aliyun lightweight server (student price emmmmmm), install ubuntu system! What are domain names resolve better! ok, enter the installation environment!
  • Installation environment: I use to connect xshell6
    Here Insert Picture Description
  1. First we have to look at ubuntu software update source:
sudo apt-get update
  1. Then we install MySQL, after the execution will enable us to enter the password twice database!
sudo apt install mysql-server mysql-client
  1. Then we install nginx
sudo apt-get install nginx
//然后访问服务器ip, 或者域名,出现如下的欢迎界面,那么就代表你的nginx安装成功了!

Here Insert Picture Description
4. Then we installed PHP7.0

udo apt-add-repository ppa:ondrej/php  //使用 PPA ppa:ondrej/php
sudo apt update  //更新软件库
sudo apt install php7.0 php7.0-fpm php7.0-cgi php7.0-common php7.0-curl php7.0-mysql php7.0-mcrypt php7.0-mbstring
  1. Configuring nginx, and PHPFastCGI configuration is recommended only directly with the default configuration to!
//编辑配置文件
sudo vim /etc/php/7.0/fpm/pool.d/www.conf
	#默认是socket方式
	listen = /run/php/php7.0-fpm.sock
	#TCP方式  
	listen = 127.0.0.1:9000
//然后检查下配置
sudo php-fpm7.0 -t
//然后重启一下服务
sudo service php-fpm7.0 restart
//然后我们再修改nginx的配置,修改网站目录为var/www, 然后加入主页 index.php
sudo vim /etc/nginx/sites-enabled/default
//修改好后检查一下配置!
sudo nginx -t
//然后重启
sudo service nginx restart

Here Insert Picture Description
File error!
Here Insert Picture Description
Restart successfully
Here Insert Picture Description
modify the site's root directory, and add the index.php page
Here Insert Picture Description
and cancel these lines of code comments
Here Insert Picture Description
last saved, quit!

  1. After all configuration is complete, create a index.php under var / www directory, set up to detect whether success
//在index.php里加入如下代码
<?php
   echo phpinfo();
?>

Then visit our server ip, or domain name!
Here Insert Picture Description
The following page appears, has been built successfully on your behalf! !

Guess you like

Origin blog.csdn.net/HKer_YM/article/details/93755792