Ubuntu16.04 LNMP (PHP7.0+Mysql5.7+Nginx1.10)
2016-08-14 10:51
323 查看
1. system update:
apt-get update
apt-get upgrade
2.install softwares:
sudo apt-get install nginx php7.0-fpm mysql-server-5.6 php7.0-mysql
3.configer:
然后改配置文件,php的配置文件不用改就能用,nginx的配置文件不行,默认情况下是不支持php CGI的,所以得改一下:
vim /etc/nginx/sites-available/default
找到
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
#}
改成
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php5-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
大概意思就是所有以 .php 积极结尾的文件都传给php7.0-fpm去处理,处理完了把结果发给nginx,然后再由nginx发给客户机
然后重启一下服务:
systemctl restart nginx
systemctl restart php7.0-fpm
systemctl restart mysql
就好啦默认的网站根目录在/var/www/html/(可以通过nginx的配置文件里root 的那行改)
题主要是想搭wordpress之类的话,要把index.php当做主页的
就是把nginx配置文件中的
index index.html index.htm index.nginx-debian.html;
改成 index.php
apt-get update
apt-get upgrade
2.install softwares:
sudo apt-get install nginx php7.0-fpm mysql-server-5.6 php7.0-mysql
3.configer:
然后改配置文件,php的配置文件不用改就能用,nginx的配置文件不行,默认情况下是不支持php CGI的,所以得改一下:
vim /etc/nginx/sites-available/default
找到
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
#}
改成
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php5-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
大概意思就是所有以 .php 积极结尾的文件都传给php7.0-fpm去处理,处理完了把结果发给nginx,然后再由nginx发给客户机
然后重启一下服务:
systemctl restart nginx
systemctl restart php7.0-fpm
systemctl restart mysql
就好啦默认的网站根目录在/var/www/html/(可以通过nginx的配置文件里root 的那行改)
题主要是想搭wordpress之类的话,要把index.php当做主页的
就是把nginx配置文件中的
index index.html index.htm index.nginx-debian.html;
改成 index.php
相关文章推荐
- Ubuntu16.04 php7.0+mysql5.7+apache2环境搭配
- ubuntu16.04搭建lamp环境(Apache2+PHP7.0+MySQL5.7)
- Ubuntu16.04 php7.0+mysql5.7+apache2环境搭配
- LEMP(LNMP)环境搭建(ubuntu16.04(ubuntu14.04)+nginx+mysql5.7+php7.1)
- ubuntu14.0.1LTS安装LAMP(PHP7.0+Mysql5.7+Apache2.4)
- Ubuntu16.04 中PHP7.0 安装pdo_mysql 扩展
- 安装PHP yii2框架(PHP7.0+mysql+nginx+Ubuntu16.04)
- ubuntu16.04 安装 lnmp 及php 多线程 初级版本
- ubuntu 16.04 环境中安装 php7.0 redis扩展
- Ubuntu16.04 配置PHP7.0开发环境
- Ubuntu16.04 安装PHP7.0扩展
- Ubuntu14.04下配置PHP7.0+Apache2+Mysql5.7
- Ubuntu 16.04 LAMP(PHP7.0) 环境搭建并测试
- Ubuntu16.04 LTS 环境下部署Apache2+MariaDB+Php7.0
- ubuntu 16.04 安装php7.0扩展
- ubuntu16.04安装PHP7.0的laravel必须扩展
- ubuntu 16.04安装php7.0 redis扩展及使用php操作redis
- Ubuntu14.04下配置PHP7.0+Apache2+Mysql5.7
- ubuntu16.04下安装php7.0
- Ubuntu16.04 中PHP7.0 安装pdo_mysql 扩展