Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting Up LAMP Test Server for Intranet Access

Status
Not open for further replies.

PCHomepage

Programmer
Feb 24, 2009
609
1
16
US
I've done this many times both on WAMP and LAMP where I am accessing development sites from within the same system but now I am setting up a LAMP test server (Ubuntu Server 12.10 64bit) that I need to be able to access from other computers on the network and I am not sure what to use for the hosts IP for each site. There is also Apache2 server running on another PC with the 127.0.0.X range but if I use one of these here, then try to access it remotely, it simply shows the other Apache.

I also tried another IP address but, of course, the DNS fails to resolve. In the /etc/apache2/sites-available/domain I have:

Code:
<VirtualHost 10.0.0.20:80>

	DocumentRoot /var/[URL unfurl="true"]www/domain/[/URL]
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/[URL unfurl="true"]www/domain/>[/URL]
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

	ServerAlias [URL unfurl="true"]http://test.domain.com[/URL]

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log
	LogLevel warn
	CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

But there seems to be another place containing VirtualHost information at /etc/apache2/conf.d/domain.conf with:

Code:
<VirtualHost 10.0.0.20:80>
Options Indexes
DocumentRoot /var/[URL unfurl="true"]www/domain[/URL]
DirectoryIndex index.php
ServerName test.domain.com
ErrorLog /var/log/apache2/error.log
</VirtualHost>

but changes to the latter seem to be ineffective so it is redundant? Which IP should I use?
 
LAMP test server (Ubuntu Server 12.10 64bit)
My experience with Ubuntu and Apache is that the main host configuration file is under the /etc/apache2/sites-available, which then gets linked into the sites-enabled. While it is probably not the proper form, I have always used the 000-default file. To use other ones, you will need to go upstream in the configuration files and tell it to use them instead or in addition to. If you haven't yet, I would strongly suggest looking at the Ubuntu Wikis regarding Apache as Canonical has heavily modified the standard configurations and these documents will be invaluable in understanding how they organized things.
I also tried another IP address but, of course, the DNS fails to resolve
I am not entirely sure I understand what you are saying here. According to the host configuration, <VirtualHost 10.0.0.20:80>, this instance of Apache will listen on the IP address of 10.0.0.20 for connections to port 80 (http only). I would first use the netstat command to see what ports the system is listening on, then make sure you don't have any firewall, e.g. IPTables, blocking the connections, then scan it from another host to be sure that the IP and port are open across the LAN. As far as DNS goes, this sounds like another issue.
There is also Apache2 server running on another PC with the 127.0.0.X range but if I use one of these here, then try to access it remotely, it simply shows the other Apache.
Listening in the 127.0.0.x range is local to that machine only. If you access a page from the machine you will get the correct information, but only from that machine. It will not be accessible by another machine.



 
Thank you for the reply. I've read just about everything I could find prior to posting but there was nothing to suggest an IP to use for local VirtualHost sites. The IP of 10.0.0.20 that my examples above have was found in an example online but there was no hint as to what it should actually be. My local network is in the 192.168.0.X range.

I'll do further research but in the meantime, if using only the /etc/apache2/sites-available/domain, what should be in /etc/apache2/conf.d/domain.conf or should it be empty or deleted? Also, I can reach the default "It Works" from other systems on the network so there is likely no firewall issue.
 
The IP of 10.0.0.20 that my examples above have was found in an example online but there was no hint as to what it should actually be. My local network is in the 192.168.0.X range.
That is the address at which Apache will try to listen for connections. It should either be the IP address of one of that host's interfaces (e.g. if it has more than one), or you can use * for a wildcard meaning listen on all interfaces.

The configuration file in sites-available is going to be the main configuration file. Taking a closer look at my own Ubuntu - Apache server, at the /etc/apache2/conf.d directory in particular, I noticed that it contains some extra configuration files for various applications, such as phpmyadmin and Ampache. Looking at these files tells me that it is a location where you can place additional or override configuration information. Running grep against these file names doesn't give me any hits, which tells me that Apache must read these files upon start up automatically. For example, the ampache.conf contains.

Code:
Alias /ampache /usr/share/ampache/www

<Directory /usr/share/ampache/www>
  Options FollowSymLinks
  AllowOverride Limit Options FileInfo
</Directory>

This creates the subfolder called ampache off my domain, points it to the proper web files that are outside of my document root, and sets the proper options.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top