创建/编辑配置文件
#(自己设置虚拟主机的配置文件)
vi /etc/nginx/site-available/www.myredis.local.com
server {listen 80;root /var/www/html/tp3;index index.html index.htm index.php;server_name www.myredis.local.com;location / {index index.html index.php; try_files $uri $uri/ =404;if (!-e $request_filename) {rewrite ^(.*)$ /index.php?s=$1 last;#rewrite ^/(.*)$ /index.php?s=$1 last;break;}autoindex on;}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000#location ~ \.php$ {fastcgi_pass unix:/run/php/php7.0-fpm.sock;fastcgi_index index.php;#fastcgi_split_path_info ^(.+\.php)(.*)$;fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;fastcgi_param PATH_INFO $fastcgi_path_info;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;include fastcgi_params;}}
保存退出。
ln -s /etc/nginx/site-available/www.myredis.local.com /etc/nginx/site-enabled/
重启nginx
service nginx restart