zoukankan      html  css  js  c++  java
  • 使用nginx做为静态服务器--监听两个域名配置

    Html代码  收藏代码
    1. #user  nobody;  
    2. worker_processes  1;  
    3.   
    4. #error_log  logs/error.log;  
    5. #error_log  logs/error.log  notice;  
    6. #error_log  logs/error.log  info;  
    7.   
    8. #pid        logs/nginx.pid;  
    9.   
    10.   
    11. events {  
    12.     worker_connections  1024;  
    13. }  
    14.   
    15.   
    16. http {  
    17.     include       mime.types;  
    18.     default_type  application/octet-stream;  
    19.   
    20.     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '  
    21.     #                  '$status $body_bytes_sent "$http_referer" '  
    22.     #                  '"$http_user_agent" "$http_x_forwarded_for"';  
    23.   
    24.     #access_log  logs/access.log  main;  
    25.   
    26.     sendfile        on;  
    27.     #tcp_nopush     on;  
    28.   
    29.     #keepalive_timeout  0;  
    30.     keepalive_timeout  65;  
    31.   
    32.     #gzip  on;  
    33.   
    34.     server {  
    35.         listen       80;  
    36.         # 第一个域名  
    37.         server_name  shang.henushang.com;  
    38.   
    39.         #charset koi8-r;  
    40.   
    41.         #access_log  logs/host.access.log  main;  
    42.   
    43.         location / {  
    44.             root   html;  
    45.             index  index.html index.htm;  
    46.         }  
    47.   
    48.         #error_page  404              /404.html;  
    49.   
    50.         # redirect server error pages to the static page /50x.html  
    51.         #  
    52.         error_page   500 502 503 504  /50x.html;  
    53.         location = /50x.html {  
    54.             root   html;  
    55.         }  
    56.   
    57.         # proxy the PHP scripts to Apache listening on 127.0.0.1:80  
    58.         #  
    59.         #location ~ .php$ {  
    60.         #    proxy_pass   http://127.0.0.1;  
    61.         #}  
    62.   
    63.         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000  
    64.         #  
    65.         #location ~ .php$ {  
    66.         #    root           html;  
    67.         #    fastcgi_pass   127.0.0.1:9000;  
    68.         #    fastcgi_index  index.php;  
    69.         #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;  
    70.         #    include        fastcgi_params;  
    71.         #}  
    72.   
    73.         # deny access to .htaccess files, if Apache's document root  
    74.         # concurs with nginx's one  
    75.         #  
    76.         #location ~ /.ht {  
    77.         #    deny  all;  
    78.         #}  
    79.     }  
    80.   
    81.           
    82.     server {  
    83.         listen       80;  
    84.         #第二个域名  
    85.         server_name  cui.henushang.com;  
    86.   
    87.         #charset koi8-r;  
    88.   
    89.         #access_log  logs/host.access.log  main;  
    90.   
    91.         location / {  
    92.             root   html;  
    93.             # 设置第二个域名默认访问500错误页面以作区分  
    94.             index  50x.html;  
    95.         }  
    96.   
    97.         #error_page  404              /404.html;  
    98.   
    99.         # redirect server error pages to the static page /50x.html  
    100.         #  
    101.         error_page   500 502 503 504  /50x.html;  
    102.         location = /50x.html {  
    103.             root   html;  
    104.         }  
    105.   
    106.         # proxy the PHP scripts to Apache listening on 127.0.0.1:80  
    107.         #  
    108.         #location ~ .php$ {  
    109.         #    proxy_pass   http://127.0.0.1;  
    110.         #}  
    111.   
    112.         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000  
    113.         #  
    114.         #location ~ .php$ {  
    115.         #    root           html;  
    116.         #    fastcgi_pass   127.0.0.1:9000;  
    117.         #    fastcgi_index  index.php;  
    118.         #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;  
    119.         #    include        fastcgi_params;  
    120.         #}  
    121.   
    122.         # deny access to .htaccess files, if Apache's document root  
    123.         # concurs with nginx's one  
    124.         #  
    125.         #location ~ /.ht {  
    126.         #    deny  all;  
    127.         #}  
    128.     }  
    129.     
    130.   
    131.     # another virtual host using mix of IP-, name-, and port-based configuration  
    132.     #  
    133.     #server {  
    134.     #    listen       8000;  
    135.     #    listen       somename:8080;  
    136.     #    server_name  somename  alias  another.alias;  
    137.   
    138.     #    location / {  
    139.     #        root   html;  
    140.     #        index  index.html index.htm;  
    141.     #    }  
    142.     #}  
    143.   
    144.   
    145.     # HTTPS server  
    146.     #  
    147.     #server {  
    148.     #    listen       443 ssl;  
    149.     #    server_name  localhost;  
    150.   
    151.     #    ssl_certificate      cert.pem;  
    152.     #    ssl_certificate_key  cert.key;  
    153.   
    154.     #    ssl_session_cache    shared:SSL:1m;  
    155.     #    ssl_session_timeout  5m;  
    156.   
    157.     #    ssl_ciphers  HIGH:!aNULL:!MD5;  
    158.     #    ssl_prefer_server_ciphers  on;  
    159.   
    160.     #    location / {  
    161.     #        root   html;  
    162.     #        index  index.html index.htm;  
    163.     #    }  
    164.     #}  
    165.   
    166. }  
  • 相关阅读:
    HDU 6143 Killer Names【dp递推】【好题】【思维题】【阅读题】
    HDU 6143 Killer Names【dp递推】【好题】【思维题】【阅读题】
    POJ 3974 Palindrome【manacher】【模板题】【模板】
    POJ 3974 Palindrome【manacher】【模板题】【模板】
    HDU 6127 Hard challenge【计算机几何】【思维题】
    HDU 6127 Hard challenge【计算机几何】【思维题】
    HDU 6129 Just do it【杨辉三角】【思维题】【好题】
    HDU 6129 Just do it【杨辉三角】【思维题】【好题】
    HDU 3037 Saving Beans【Lucas定理】【模板题】【模板】【组合数取余】
    8.Math 对象
  • 原文地址:https://www.cnblogs.com/wanghuaijun/p/5461185.html
Copyright © 2011-2022 走看看