大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
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
配置完成。