ServerName outside VirtualHost mostly has cosmetic effect AFAIU, just
put some canonical name of your server there.
--
With Best Regards,
Marat Khalili
On 16/11/16 07:33, 水静流深 wrote:
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?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org