Webhosting using apache
hi guys, need your insight on this.
if i have one static ip and my centos server is behind a cisco nat router. Cisco nat router already configured for nat translation from public ip to private ip and vice versa. now my question is, how do i set the apache so the site can be hosted locally and over the internet as well. what i mean is, i can access the site locally using: http://192.168.1.100:8000 and also: using the internet like: http://mywebsite.com:8000 is there a way to do it? please bear with me, trying to figure out things in CENTOS. thanks in advance for any input, ;) |
Have you tried changing the default listen port on Apache from 80 to 8000 ?
Look at line 276 in /etc/httpd/conf/httpd.conf ?? |
You can do that with virtual hosts that share the same document root.
http://httpd.apache.org/docs/2.2/en/vhosts/ |
Quote:
So such scenario can only be done using virtual hosts. Is there any other workaround on it, aside from using virtual hosts? Thanks. |
Maybe there are other opportunities but the virtual hosts are pretty straightforward for this. Copy 12 lines to your httpd.conf, edit them according to your names and restart the server. That's it.
NameVirtualHost *:80 <VirtualHost *:80> ServerName www.domain.tld ServerAlias domain.tld *.domain.tld DocumentRoot /www/domain </VirtualHost> <VirtualHost *:80> ServerName www.otherdomain.tld DocumentRoot /www/domain </VirtualHost> |
Moderator response
Moved: This thread is more suitable in <Linux-Server> and has been moved accordingly to help your thread/question get the exposure it deserves.
|
Quote:
I'm sure there's some other way, please share your ideas. :) |
hi, is there any software to support multiple hosting other than using virtual hosts in CentOS... thanks.
|
Learn about vhosts and use apache, that's what the rest of the world has done!
|
Quote:
I had checked the httpd.conf under the vhost settings but there's nothing over there. There's not even any changes from the original httpd.conf settings, so i don't know how they did it. That's why i'm asking. |
Two commands on the command line would probably tell you how.
httpd -? to get the help, then httpd -S to show the vhosts. If you're not getting that far on your own then I wouldn't recommend running a production web server for anyone until you've a bit more experience, but that's just my opinion. |
Depending on the distribution the default location to look for virtual host configs are i. E.
/etc/apache2/vhosts.d /etc/apache2/sites-enabled or such but probably you find some additional configs that are loaded in httpd.conf. Quote:
|
Quote:
[root@myserver user1]# /usr/sbin/httpd -S httpd: apr_sockaddr_info_get() failed for myserver.server.com httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName VirtualHost configuration: Syntax OK i just wanted to know how they were able to host multiple sites without using the vhost, please don't be too harsh in your comment. I'm not trying to mess up with the server, i just wanted to check their configuration. Thanks. |
Quote:
same goes with the sites-enabled, any ideas how they were able to hosts multiple sites on the server without those configurations? thanks. |
thank you guys i finally found the configuration, i type find / -name httpd.conf - print there were three httpd.conf.
the other two httpd.conf, were bogus no configuration settings on it but the other one got configuration on the virtualhost. :) |
All times are GMT -5. The time now is 08:24 PM. |