zoukankan      html  css  js  c++  java
  • Nginx高性能服务器安装、配置、运维 (5) —— Nginx虚拟主机配置

     

    六、Nginx虚拟主机配置

     

    建立基于域名的虚拟主机:

    (1)建立基于域名的虚拟主机配置文件(以abc.com为例):

     

     

    (2)更改虚拟主机配置文件:

     

     

    更改配置如下(更改部分即可):


    server {
    listen 80;                  #侦听端口
    server_name abc.com;              #虚拟机主机名(这里填入域名绑定)

    #charset koi8-r;               
    #access_log /var/log/nginx/log/host.access.log main;    
    root /mnt/www/abc.com;              #指定WEB根目录
    location / {
    index index.php index.html index.htm;       #指定默认读取文件(读取顺序从左往右)
    }

    #error_page 404 /404.html;          

    # redirect server error pages to the static page /50x.html
    #
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ .php$ {
    # proxy_pass http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ .php$ {
    # root html;
    # fastcgi_pass 127.0.0.1:9000;
    # fastcgi_index index.php;
    # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
    # include fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /.ht {
    # deny all;
    #}
    }

    (以上是基于域名的Nginx虚拟主机基本配置,更详细的配置请见LNMP配置)

    配置完成,重新加载服务:

    (本文由kayvan编辑发表,内容主要收集于互联网,转载请注明出处:http://www.cnblogs.com/kayvan


  • 相关阅读:
    javascript获取id元素
    小米供应链
    几个极限的证明
    第一章 实数
    当a在什么范围取值时,方程|x方-5x|=a有且只有两个相异实根
    壮壮的西城学探究里面的x=1,x=-1
    三角形的边长注意问题
    x方+x+1, x方-x+1无实根,不可能为0
    一个混合电路
    串联电路的电流处处相等
  • 原文地址:https://www.cnblogs.com/kayvan/p/3978561.html
Copyright © 2011-2022 走看看