0
I am trying to host two different websites in the same VPS. What are the right procedures to do this?
The server apache
is already installed and I can host files there. However I can’t host two different sites.
Man httpd.conf
has the following:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin primeiro_site@primeiro_site.com
DocumentRoot /var/www/primeiro_site/public_html
ServerName www.endereco1.com
ServerAlias endereco1.com
ErrorLog /var/www/primeiro_site/error.log
</VirtualHost>
<VirtualHost *:800>
ServerAdmin [email protected]
DocumentRoot /var/www/segundo_site/public_html
ServerName www.endereco2.com
ServerAlias endereco2.com
ErrorLog /var/www/segundo_site/error.log
</VirtualHost>
But both addresses redirect to the site 1
...
You put the
endereco2.com
at gate 800 on purpose?– fpg1503
I don’t know much about servers. I put it on 800 believing that I could access 123.4.5.6:800 for the second site as follows. But without satisfactory results...
– waghcwb
You left the
Apache
after making the change?– fpg1503
I suggest you leave the two at port 80 for easy access but to test you can not forget to configure the
DNS
or your filehosts
for local testing.– fpg1503
Yes, yes, over and over again. I followed the steps of this tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-centos-6 The only thing I didn’t do was "Optional Step Six-Setting Up the Local Hosts". I’ll test here if that would be the problem then.
– waghcwb
The reason I skipped this step is that in the tutorial they say that if I had redirected my domain to the VPS IP I could skip that step. And I rerouted both addresses to the VPS. @Edit: I updated the code, and I changed both to port 80, both with <Virtualhost *:80> But still no results...
– waghcwb
I usually do it another way using
sites-available
andsites-enabled
. Want me to post this solution as an answer for you to test?– fpg1503
Of course, all solutions are welcome.
– waghcwb