LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Webhosting using apache (https://www.linuxquestions.org/questions/linux-server-73/webhosting-using-apache-929992/)

JJJCR 02-17-2012 10:14 PM

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, ;)

ceyx 02-18-2012 12:35 AM

Have you tried changing the default listen port on Apache from 80 to 8000 ?

Look at line 276 in /etc/httpd/conf/httpd.conf

??

j-ray 02-18-2012 02:39 AM

You can do that with virtual hosts that share the same document root.

http://httpd.apache.org/docs/2.2/en/vhosts/

JJJCR 02-20-2012 09:45 PM

Quote:

Originally Posted by j-ray (Post 4605682)
You can do that with virtual hosts that share the same document root.

http://httpd.apache.org/docs/2.2/en/vhosts/

hi j-ray, thanks for the reply.

So such scenario can only be done using virtual hosts.

Is there any other workaround on it, aside from using virtual hosts?

Thanks.

j-ray 02-21-2012 04:27 AM

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>

onebuck 02-21-2012 04:07 PM

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.

JJJCR 02-22-2012 02:16 AM

Quote:

Originally Posted by onebuck (Post 4608616)
Moved: This thread is more suitable in <Linux-Server> and has been moved accordingly to help your thread/question get the exposure it deserves.

Thanks onebuck, so any ideas guys how can it be done other than virtual hosts.

I'm sure there's some other way, please share your ideas. :)

JJJCR 02-23-2012 07:53 AM

hi, is there any software to support multiple hosting other than using virtual hosts in CentOS... thanks.

TenTenths 02-23-2012 10:00 AM

Learn about vhosts and use apache, that's what the rest of the world has done!

JJJCR 02-24-2012 07:57 PM

Quote:

Originally Posted by TenTenths (Post 4610173)
Learn about vhosts and use apache, that's what the rest of the world has done!

hi TenTenths, actually my friend server who's having a small business. His Linux Server is hosting three web sites, he had asked me to check what is the configuration. So he can cancel the maintenance and do it on our own.
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.

TenTenths 02-24-2012 09:52 PM

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.

j-ray 02-25-2012 01:40 AM

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:

I wouldn't recommend running a production web server for anyone until you've a bit more experience
I don't recommend neither

JJJCR 02-26-2012 07:49 PM

Quote:

Originally Posted by TenTenths (Post 4611476)
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.

hi TenTenths, when i type httpd -S there is no configuration for the vhosts.

[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.

JJJCR 02-26-2012 07:51 PM

Quote:

Originally Posted by j-ray (Post 4611546)
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.

I don't recommend neither

Hi j-ray, i tried to search for vhosts.d, using find / -name vhosts.d -print but nothing comes out on the result.

same goes with the sites-enabled, any ideas how they were able to hosts multiple sites on the server without those configurations?

thanks.

JJJCR 02-27-2012 01:17 AM

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.