Many websites with one IP address.

Issues related to configuring your network
hack3rcon
Posts: 710
Joined: 2014/11/24 11:04:37

Many websites with one IP address.

Post by hack3rcon » 2020/10/29 15:19:47

Hello,
To launch many websites with Apache and just one IP address, I must use Virtual Host?
Consider below Virtual Host:

Code: Select all

<VirtualHost *:80>
ServerAdmin root@localhost
ServerName myexample.net
ServerAlias www.myexample.net
DocumentRoot /var/www/wordpress
<Directory "/var/www/wordpress">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
ErrorLog /var/log/httpd/wordpress_error.log
CustomLog /var/log/httpd/wordpress_access.log common
</VirtualHost>
For "myexample2.net" website, I must create another ".conf" file under "conf.d" directory with below content?

Code: Select all

<VirtualHost *:80>
ServerAdmin root@localhost
ServerName myexample2.net
ServerAlias www.myexample2.net
DocumentRoot /var/www/wordpress2
<Directory "/var/www/wordpress2">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
ErrorLog /var/log/httpd/wordpress2_error.log
CustomLog /var/log/httpd/wordpress2_access.log common
</VirtualHost>
Thank you.

BShT
Posts: 370
Joined: 2019/10/09 12:31:40

Re: Many websites with one IP address.

Post by BShT » 2020/10/30 11:59:12

yes

hack3rcon
Posts: 710
Joined: 2014/11/24 11:04:37

Re: Many websites with one IP address.

Post by hack3rcon » 2020/10/31 13:45:39

Thank you so much.

hack3rcon
Posts: 710
Joined: 2014/11/24 11:04:37

Re: Many websites with one IP address.

Post by hack3rcon » 2020/11/01 16:07:46

Excuse me, I forgot to ask a question. When my host wants to provide more than one website then in the main configuration file of Apache, the value of "ServerName" must be "localhost" ?

hack3rcon
Posts: 710
Joined: 2014/11/24 11:04:37

Re: Many websites with one IP address.

Post by hack3rcon » 2020/11/15 14:21:44

Any idea?

huyhoa
Posts: 3
Joined: 2020/11/15 10:49:07

Re: Many websites with one IP address.

Post by huyhoa » 2020/11/15 14:29:00

hack3rcon wrote:
2020/11/01 16:07:46
Excuse me, I forgot to ask a question. When my host wants to provide more than one website then in the main configuration file of Apache, the value of "ServerName" must be "localhost" ?
I think it should be server host name, like server1.hostingprovider.tld or something like that if they use https. or may be some provider will add Server IP (not secured).

User avatar
TrevorH
Forum Moderator
Posts: 29915
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Many websites with one IP address.

Post by TrevorH » 2020/11/15 14:31:54

No, ServerName should be the name of the site you want it to serve.

Please start doing some research and thinking before you ask questions. Over 700 posts from you so far and you're still asking beginner level questions?
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

hack3rcon
Posts: 710
Joined: 2014/11/24 11:04:37

Re: Many websites with one IP address.

Post by hack3rcon » 2020/11/16 09:56:38

huyhoa wrote:
2020/11/15 14:29:00
hack3rcon wrote:
2020/11/01 16:07:46
Excuse me, I forgot to ask a question. When my host wants to provide more than one website then in the main configuration file of Apache, the value of "ServerName" must be "localhost" ?
I think it should be server host name, like server1.hostingprovider.tld or something like that if they use https. or may be some provider will add Server IP (not secured).
How can I sure?

hack3rcon
Posts: 710
Joined: 2014/11/24 11:04:37

Re: Many websites with one IP address.

Post by hack3rcon » 2020/11/16 09:57:34

TrevorH wrote:
2020/11/15 14:31:54
No, ServerName should be the name of the site you want it to serve.

Please start doing some research and thinking before you ask questions. Over 700 posts from you so far and you're still asking beginner level questions?
I mean is "ServerName" in "httpd.conf" file and not Virtual Host files.

BShT
Posts: 370
Joined: 2019/10/09 12:31:40

Re: Many websites with one IP address.

Post by BShT » 2020/11/16 14:18:59

https://httpd.apache.org/docs/2.4/vhosts/examples.html

install a lab and do your tests, you will never learn if you ask for everything

fall and rise

Post Reply

Return to “CentOS 8 - Networking Support”