在主配置文件http模块最后添加如下一句话

[root@host---- ~]# vi /etc/nginx/nginx.conf
include /etc/nginx/conf.d/*.conf; [root@host-10-1-1-161 ~]# mkdir -p /etc/nginx/conf.d 把主配置文件的server复制到conf.d下面就可以 主配置文件实例: [root@bogon conf.d]# cat /etc/nginx/nginx.conf
user root root;
worker_processes 1;
events {
worker_connections 1024;
} http {
include mime.types;
default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; server {
listen 80;
server_name www.test.com;
charset utf-8;
location / {
root /var/www/www.test.com;
index index.php index.html index.htm;
} location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/www.test.com$fastcgi_script_name;
include fastcgi_params;
}
}
include /etc/nginx/conf.d/*.conf;    
} 子配置文件实例 [root@bogon ~]# cat /etc/nginx/conf.d/test1.conf
server {
listen 8083;
server_name www.test1.com;
charset utf-8;
location / {
root /website;
index index.php index.html index.htm;
} location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /website$fastcgi_script_name;
include fastcgi_params;
} }

最新文章

  1. monitor system
  2. 组合数问题hdu5894
  3. Solr DataImportHandler
  4. Autorelease pool
  5. Sublime Text2 jedi插件离线安装
  6. 用JS写的无缝滚动特效
  7. MD5加密帮助类
  8. Android---用Wi-Fi来建立对等连接
  9. Cocos2dx 3.2 节点之间相互通信与设置触摸吞噬的方法
  10. SVN在ubuntu的安装和使用
  11. [leetcode-504-Base 7]
  12. 【2018.04.19 ROS机器人操作系统】机器人控制:运动规划、路径规划及轨迹规划简介之一
  13. unity开发笔记
  14. css.1
  15. C# System.IO和对文件的读写操作
  16. 【转】同一个SQL查询语句,为什么使用到的索引不同?
  17. asp.net 连接SQL Server 数据库并进行相关操作
  18. 原生JS封装ajax方法
  19. Golang两种方法实现MD5加密
  20. 阿里云ECS提示RHSA-2017:3263: curl security update

热门文章

  1. YOLO---YOLOv3 with OpenCV 再使用
  2. PHP数组赋值
  3. Why Go? – Key advantages you may have overlooked
  4. Java8-Executors-No.03
  5. [一道区间dp][String painter]
  6. learning express step(十三)
  7. libpng warning:iCCP:known incorrect sRGB profile
  8. Feeding Chicken
  9. elasticsearch _create api创建一个不存在的文档
  10. csp-s模拟106