安裝Nginxphp
$ wget http://nginx.org/keys/nginx_signing.key $ sudo apt-key add nginx_signing.key
$ 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
$ sudo apt-get update $ sudo apt-get install nginx
$ /usr/sbin/nginx -v 安裝PHP7
$ sudo apt-get install python-software-properties software-properties-common $ sudo add-apt-repository ppa:ondrej/php $ sudo apt-get update
$ 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
打開php.ini
配置文件:html
$ sudo vim /etc/php/7.0/fpm/php.ini
cgi.fix_pathinfo
選項,去掉註釋;,而後將值設置爲0
:cgi.fix_pathinfo = 0;
python
display_errors = Onmysql
location ~ \.php$ {nginx
# include snippets/fastcgi-php.conf;sql
#ubuntu
# # With php7.0-cgi alone:vim
# fastcgi_pass 127.0.0.1:9000;php7
# # With php7.0-fpm:dom
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;
}
$ sudo apt-get install mysql-server-5.6 mysql-client-5.6
途中會提示設置MySQL的密碼,安裝好後:
$ mysql -uroot -p
而後輸入剛剛設置的密碼,能成功進入即成功安裝。