Ubuntu安裝Nginx+PHP7.0.4+MySQL5.6
安裝Nginx
1匆背、首先添加nginx_signing.key(必須,否則出錯(cuò))
$ wget http://nginx.org/keys/nginx_signing.key
$ sudo apt-key add nginx_signing.key
2捏顺、添加]Nginx](http://nginx.org/)官方提供的源
$ echo "deb http://nginx.org/packages/ubuntu/ trusty nginx" >> /etc/apt/sources.list
$ echo "deb-src http://nginx.org/packages/ubuntu/ trusty nginx" >> /etc/apt/sources.list
3涣脚、更新源并安裝Nginx
$ sudo apt-get update$ sudo apt-get install nginx
4思杯、安裝Nginx完成后可查看版本號(hào)贞铣,輸入
$?/usr/sbin/nginx -v
安裝PHP7
1闹啦、添加PPA
$ sudo apt-get install python-software-properties software-properties-common
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
2、安裝PHP7以及所需的一些擴(kuò)展
$ sudo apt-get?install php7.0-fpm php7.0-mysql php7.0-common php7.0-curl php7.0-cli php7.0-mcrypt php7.0-mbstring php7.0-dom
3辕坝、配置PHP7
打開php.ini配置文件:
$?sudo vim /etc/php/7.0/fpm/php.ini
找到cgi.fix_pathinfo選項(xiàng)窍奋,去掉注釋;,然后將值設(shè)置為0:
cgi.fix_pathinfo =?0;
display_errors ?= ?On
location ~ \.php$ {
? ? ? ? ? # include snippets/fastcgi-php.conf;
? ? ? ?? #
? ? ? ? ? # # With php7.0-cgi alone:
? ? ? ? # fastcgi_pass 127.0.0.1:9000;
? ? ? ?? # # With php7.0-fpm:
? ? ? ? ? ? ? ?? fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
? ? ? ? ? ? ? ? ? fastcgi_pass unix:/run/php/php7.0-fpm.sock;
? ? ? ? ? ? ? ? ? fastcgi_index index.php;
? ? ? ? ? ? ? ? ? include fastcgi_params;
}
安裝MySQL
安裝mysql
$ sudo apt-get?install?mysql-server-5.6?mysql-client-5.6
途中會(huì)提示設(shè)置MySQL的密碼酱畅,安裝好后:
$?mysql -uroot -p
然后輸入剛剛設(shè)置的密碼琳袄,能成功進(jìn)入即成功安裝。