httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "水静流深" <1248283...@qq.com>
Subject [users@httpd] Which config file is fit for my apache2?
Date Wed, 16 Nov 2016 04:33:16 GMT
Let's suppose a scene on centos7.  

- domain name:  xyz.com    
- the domain parsed by third-party dns server:   ns1.xxx.com     
- IP address bound with domain:  123.123.123.123     
- apache2 was installed on  123.123.123.123      

It is the ServerName confused me.
### ServerName      

In the `/etc/httpd/conf/httpd.conf`, `ServerName` gives the name and port that the server
uses to identify itself. This can often be determined automatically, but we recommend you
specify it explicitly to prevent problems during startup. If your host doesn't have a registered
DNS name, enter its IP address here.

    #ServerName [url]www.example.com:80[/url]

Should my /etc/httpd/conf/httpd.conf be this way :

    config1:

    ServerRoot "/etc/httpd"
    Listen 80
    Include conf.modules.d/*.conf
    User apache
    Group apache
    ServerName 123.123.123.123:80
    <VirtualHost *:80>
        ServerName [url]www.xyz.com[/url]
        DocumentRoot "/var/www/html"
    </VirtualHost>

    config2:  

    ServerRoot "/etc/httpd"
    Listen 80
    Include conf.modules.d/*.conf
    User apache
    Group apache
    ServerName xyz.com:80
    <VirtualHost *:80>
        ServerName [url]www.xyz.com[/url]
        DocumentRoot "/var/www/html"
    </VirtualHost>

    config3:  

    ServerRoot "/etc/httpd"
    Listen 80
    Include conf.modules.d/*.conf
    User apache
    Group apache
    ServerName localhost:80
    <VirtualHost *:80>
        ServerName [url]www.xyz.com[/url]
        DocumentRoot "/var/www/html"
    </VirtualHost>

    config4:  

    ServerRoot "/etc/httpd"
    Listen 80
    Include conf.modules.d/*.conf
    User apache
    Group apache
    ServerName 127.0.0.1:80
    <VirtualHost *:80>
        ServerName [url]www.xyz.com[/url]
        DocumentRoot "/var/www/html"
    </VirtualHost>

Which config file is fit for my example?
Mime
View raw message