LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-28-2009, 10:56 PM   #1
Niceman2005
Member
 
Registered: Nov 2004
Distribution: Fedora Core 2
Posts: 330

Rep: Reputation: 30
httpd: serve internally access site on one IP


Dear friends,

I have an apache httpd server hosting my phpldapadmin, drupal website, other websites.

I tried to achieve the following:
-The phpldapadmin and drupal are meant for internal access only, while the rest of the websites are OK for external access.
[There for i used <VirtualHost 192.168.1.100:80>] for both the phpldapadmin and drupal httpd virtual host configuration

-When i type http://192.168.1.100 at the browser, by default it would direct to the drupal page

So, i have the following configuration in my httpd.conf virtual host section:

NameVirtualHost *:80

<VirtualHost 192.168.1.100:80>
ServerAdmin admin@shinyang.com.my
DocumentRoot /var/www/html/drupal
ServerName drupal
</VirtualHost>

<VirtualHost 192.168.1.100:80>
ServerAdmin admin@shinyang.com.my
DocumentRoot /var/www/html/ldap
ServerName ldap
</VirtualHost>


Somehow this doesn't work, when i type http://192.168.1.100, it simply direct to the phpldapadmin page. While i have to type http://192.168.1.100/drupal into order to access the drupal page.

So basically i want to restrict drupal and phpldapadmin for internet access only, and by default http://192.168.1.100 -> drupal page, while i can access the ldap page by typing http://192.168.1.100/ldap

I can't acheive that, maybe it is not possible to have two sites with the same local IP and port. So the other possibility is to change the phpldapadmin to:
<VirtualHost 192.168.1.100:85>

but i think to access a site from local, i can't define the port as this:
http://192.168.1.100/ldap:85, this way doesn't work.

Also i need to set up DNS entry for the internal phpldapadmin and drupal sites, DNS entry cannot with port number.
...not sure if my query is clear, basically if it is possible to setup one IP internally to many domain name or access url.

For external access sure is ok, just for internal configuration..
hope someone might help, thanks
 
Old 04-29-2009, 01:52 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
You need the ServerAlias option
Code:
<VirtualHost 192.168.1.100:80>
ServerAdmin admin@shinyang.com.my
DocumentRoot /var/www/html/drupal
ServerName drupal
ServerAlias www.drupal.shinyang.com
</VirtualHost>
and similarly for each virtual server
 
Old 04-29-2009, 01:58 AM   #3
PEdroArthur_JEdi
LQ Newbie
 
Registered: Jan 2008
Distribution: Slackware | Debian
Posts: 17

Rep: Reputation: 1
Quote:
Originally Posted by Niceman2005 View Post
I can't acheive that, maybe it is not possible to have two sites with the same local IP and port. So the other possibility is to change the phpldapadmin to:
Actually it's possible, but Apache will use the last given value.

Quote:
Originally Posted by Niceman2005 View Post
but i think to access a site from local, i can't define the port as this:
http://192.168.1.100/ldap:85, this way doesn't work.
I think your request is wrong... try: http://192.168.1.100:85/ldap

BTW, you added "Listen 85" to your apache's config file?

Quote:
Originally Posted by Niceman2005 View Post
Also i need to set up DNS entry for the internal phpldapadmin and drupal sites, DNS entry cannot with port number.
This isn't clear to me... Even with domain name resolution, you may still use a port number. Like in http://example.com:8080/phpldapadmin

Quote:
Originally Posted by Niceman2005 View Post
...not sure if my query is clear, basically if it is possible to setup one IP internally to many domain name or access url.
You will just need to setup the ServerName on yours VirtualHost setups so Apache may redirect you to the right vhost.

I hope it gets clear!
 
Old 04-29-2009, 02:50 AM   #4
Niceman2005
Member
 
Registered: Nov 2004
Distribution: Fedora Core 2
Posts: 330

Original Poster
Rep: Reputation: 30
Wow thanks to both of your replies!
Got it working with PEdroArthur_JEdi's correction for my url:
http://192.168.1.100/ldap:85 should change to http://192.168.1.100:85/ldap

Now it is working perfectly fitting my requirement, thanks a lot for both of your advices and detail explanation!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
web site directory security? .htaccess or httpd.conf Moonman Linux - Software 0 03-03-2006 08:51 PM
Httpd.conf for access control BillyB Linux - Newbie 1 02-26-2005 01:23 PM
httpd access log entries hywaydave Linux - Security 3 02-11-2005 03:39 PM
Can't access ssh or httpd from outside subnet vortech Linux - Networking 1 10-03-2002 04:39 PM
Can my DNS box serve my site through cash to save bandwidth? 360 Linux - Networking 1 06-04-2002 10:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration