Nginx-PHP-7-FPM-Ubuntu.jpg
安装 nginx
# apt-get install python-software-properties
# add-apt-repository ppa:nginx/stable
# apt-get update
# apt-get install nginx
安装 php7-fpm
# add-apt-repository ppa:ondrej/php
# apt-get update
# apt-get install -y php7.0 php7.0-fpm
安装 percona-server-5.7
# wget https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb
# dpkg -i percona-release_0.1-4.$(lsb_release -sc)_all.deb
# apt-get update
# apt-get install percona-server-server-5.7
在 /etc/nginx/site-enable 修改 default 文件
server {
listen 80;
root /var/www/project/public;
index index.php index.html index.htm;
server_name host.dev;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~* \.(apk|png|jpg|jpeg|gif|ico|swf)$ {
expires max;
error_page 405 =200 $uri;
}
location = /server-status {
stub_status on;
}
location ~ \.(hh|php)$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
}
}
在 /etc/php/7.0/fpm/pool.d 修改 www.conf
listen = [::]:9000
在 /etc/hosts 文件添加一行
127.0.0.1 host.dev
在 /var/www/project/public 添加一个 index.php 文件
浏览器打开 http://host.dev 即可看到这个文件