ubuntu16.04nginx+php+mysql配置

sudo apt update
sudo apt-get install nginx
sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install php-cli php-cgi php-mysql
sudo apt-get install php-fpm
nginx + php + msyql 安装完毕
localhost中可以看到效果

定远网站建设公司创新互联公司,定远网站设计制作,有大型网站制作公司丰富经验。已为定远成百上千提供企业网站建设服务。企业网站搭建\成都外贸网站制作要多少钱,请找那个售后服务好的定远做网站的公司定做!

虚拟主机配置
复制以下的代码到/etc/nginx/conf.d/test.api.com.conf

server
{
listen 80;
server_name test.api.com;
index index.php server.php index.html;
access_log /var/log/test_api.log;
error_log /var/log/test_api.log;

set $path /var/www/test.api.com;
root $path;
location / {
#try_files $uri $uri/ /index.php?$args;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}

location ~ .php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
# fastcgi_pass 127.0.0.1:9000;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param ENV _jxl;
include fastcgi_params;
}
server_tokens off;
}


sudo nginx -t //测试看下配置后有没有问题
sudo service nginx restart
配置完成。


当前标题:ubuntu16.04nginx+php+mysql配置
网页URL:http://pwwzsj.com/article/cpcges.html