1. #user  nobody;
  2. worker_processes  1;
  3. #error_log  logs/error.log;
  4. #error_log  logs/error.log  notice;
  5. #error_log  logs/error.log  info;
  6. #pid        logs/nginx.pid;
  7. events {
  8. worker_connections  1024;
  9. }
  10. http {
  11. include       mime.types;
  12. default_type  application/octet-stream;
  13. #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
  14. #                  '$status $body_bytes_sent "$http_referer" '
  15. #                  '"$http_user_agent" "$http_x_forwarded_for"';
  16. #access_log  logs/access.log  main;
  17. sendfile        on;
  18. #tcp_nopush     on;
  19. #keepalive_timeout  0;
  20. keepalive_timeout  65;
  21. #gzip  on;
  22. server {
  23. listen       80;
  24. # 第一个域名
  25. server_name  shang.henushang.com;
  26. #charset koi8-r;
  27. #access_log  logs/host.access.log  main;
  28. location / {
  29. root   html;
  30. index  index.html index.htm;
  31. }
  32. #error_page  404              /404.html;
  33. # redirect server error pages to the static page /50x.html
  34. #
  35. error_page   500 502 503 504  /50x.html;
  36. location = /50x.html {
  37. root   html;
  38. }
  39. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  40. #
  41. #location ~ \.php$ {
  42. #    proxy_pass   http://127.0.0.1;
  43. #}
  44. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  45. #
  46. #location ~ \.php$ {
  47. #    root           html;
  48. #    fastcgi_pass   127.0.0.1:9000;
  49. #    fastcgi_index  index.php;
  50. #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
  51. #    include        fastcgi_params;
  52. #}
  53. # deny access to .htaccess files, if Apache's document root
  54. # concurs with nginx's one
  55. #
  56. #location ~ /\.ht {
  57. #    deny  all;
  58. #}
  59. }
  60. server {
  61. listen       80;
  62. #第二个域名
  63. server_name  cui.henushang.com;
  64. #charset koi8-r;
  65. #access_log  logs/host.access.log  main;
  66. location / {
  67. root   html;
  68. # 设置第二个域名默认访问500错误页面以作区分
  69. index  50x.html;
  70. }
  71. #error_page  404              /404.html;
  72. # redirect server error pages to the static page /50x.html
  73. #
  74. error_page   500 502 503 504  /50x.html;
  75. location = /50x.html {
  76. root   html;
  77. }
  78. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  79. #
  80. #location ~ \.php$ {
  81. #    proxy_pass   http://127.0.0.1;
  82. #}
  83. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  84. #
  85. #location ~ \.php$ {
  86. #    root           html;
  87. #    fastcgi_pass   127.0.0.1:9000;
  88. #    fastcgi_index  index.php;
  89. #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
  90. #    include        fastcgi_params;
  91. #}
  92. # deny access to .htaccess files, if Apache's document root
  93. # concurs with nginx's one
  94. #
  95. #location ~ /\.ht {
  96. #    deny  all;
  97. #}
  98. }
  99. # another virtual host using mix of IP-, name-, and port-based configuration
  100. #
  101. #server {
  102. #    listen       8000;
  103. #    listen       somename:8080;
  104. #    server_name  somename  alias  another.alias;
  105. #    location / {
  106. #        root   html;
  107. #        index  index.html index.htm;
  108. #    }
  109. #}
  110. # HTTPS server
  111. #
  112. #server {
  113. #    listen       443 ssl;
  114. #    server_name  localhost;
  115. #    ssl_certificate      cert.pem;
  116. #    ssl_certificate_key  cert.key;
  117. #    ssl_session_cache    shared:SSL:1m;
  118. #    ssl_session_timeout  5m;
  119. #    ssl_ciphers  HIGH:!aNULL:!MD5;
  120. #    ssl_prefer_server_ciphers  on;
  121. #    location / {
  122. #        root   html;
  123. #        index  index.html index.htm;
  124. #    }
  125. #}
  126. }

使用nginx做为静态服务器--监听两个域名配置的更多相关文章

  1. Scoket 服务器监听多个客户端发来的图片

    这是服务器 直接上代码 都有详细注释 注意线程需要自己手动关闭 不然程序会卡死 /* ######### ############ ############# ## ########### ### # ...

  2. SpringBoot中如何监听两个不同源的RabbitMQ消息队列

    spring-boot如何配置监听两个不同的RabbitMQ 由于前段时间在公司开发过程中碰到了一个问题,需要同时监听两个不同的rabbitMq,但是之前没有同时监听两个RabbitMq的情况,因此在 ...

  3. udp服务器监听(多线程)

    项目一:udp1111 监听的有三个文件分别为: guiHello.java 有关界面和事件响应功能 UdpFunc.java是udp类的封装:发送和接收 udpServer.java是入口函数,无实 ...

  4. Nginx搭建动态静态服务器

    Nginx做静态资源服务器优于Tomcat 区分静态资源,动态资源请求 使用域名区分! 如果是动态资源请求  反向代理到 Tomcat 如果 是静态资源请求  直接走本地Nginx 配置: ###静态 ...

  5. 从零开始学习Node.js例子五 服务器监听

    httpsnifferInvoke.js var http = require('http'); var sniffer = require('./httpsniffer'); var server ...

  6. java项目---用java实现简单TCP服务器监听(3星)

    ---------------------------------------------服务端----------------------------------------------- 1 pa ...

  7. node.js 基础二 开启服务器监听

    1.server.js 2.监听 一 server.js 二 监听 运行server.js后,浏览器打开:http://localhost:8888/ //====================== ...

  8. 配置Tomcat监听80端口、配置Tomcat虚拟主机、Tomcat日志

    6月27日任务 16.4 配置Tomcat监听80端口16.5/16.6/16.7 配置Tomcat虚拟主机16.8 Tomcat日志扩展邱李的tomcat文档 https://www.linuser ...

  9. (修改)oracle11g监听多台主机配置,用pl/sql连接操作多个数据库详解

    很多朋友在开发项目中并不是每个人用一个数据库,而是有单独的一台主机作为开发的数据库服务器,这样,就需要我们的开发人员去连接它. 首先是进入oracle的 Net  Mananger:

随机推荐

  1. Mysql数据库迁移 Ubuntu14.04

    1. 停止数据库服务 sudo service mysql stop 2. 创建数据迁移目标文件夹(实际应该是挂载到新硬盘上) cd /var/lib ls -l drwx------  6 mysq ...

  2. js 的数据类型转换

    一直对js的类型转换一直半解,今天理一下思路,首先说一下几个特殊的数值 null null是特殊的object,故 typeof null 返回object, null派生于undefined ,故 ...

  3. C#获取“所有用户桌面”的路径

    想用C#得到The All Users Desktop(Public\Desktop)的路径. 原来以为很简单,然而 Environment.GetFolderPath(Environment.Spe ...

  4. html5入门信息

    1.canvas 1)介绍:HTML5 <canvas> 标签用于绘制图像(通过脚本,通常是 JavaScript).不过,<canvas> 元素本身并没有绘制能力(它仅仅是图 ...

  5. JavaScript 高级程序设计 02-变量、数据类型

    一.JavaScript变量 1.变量的定义 在定义变量时,统一使用关键字var,后跟变量名(即标识符,如果不知道什么是标识符,可以到这去查看),如下 var message; //定义一个变量 注意 ...

  6. phpcms v9 自定义分页 带下拉跳转

    <?php function new_pages($num, $curr_page, $perpage = 20, $urlrule = '', $array = array(),$setpag ...

  7. liger 的 ligerDialog 的使用。

    /// 查看页面,跳出一个新的添加窗口 function AddMessage() { $.ligerDialog.open({ url: UrlAddMessage, height: , width ...

  8. linux 输入子系统(3)----事件处理(input_handler层)

    输入子系统主要设计input_dev.input_handler.input_handle.如下: [1]每个struct input_dev代表一个输入设备 struct input_dev { c ...

  9. P1654: [Usaco2006 Jan]The Cow Prom 奶牛舞会

    裸的强连通 ; type node=record f,t:longint; end; var n,m,dgr,i,u,v,num,ans:longint; bfsdgr,low,head,f:arra ...

  10. Objective-C中的数据类型、常量、变量、运算符与表达式

    1.Objective-C中的数据类型: Objective-C中的基本数据类型有:int.char(-128-127).float.double.BOOL,Byte(0-255) Id类型相当于(等 ...