Apache Virtual Host Document Root
Hi All,
I'm now configuring my web server to server different Virtual Hosts based on DNS name. Right now I store my files in /var/www per the default installation settings in Apache. Questions: I want to change the Document Root to /home/username/public_html/example1.dyndns.org for the second virtual server. What do the permissions need to be in order for Apache to read the files in this location? Would it be best to force Apache to run as this new username instead of www-data? My Virtual host setup will look something like this <VirtualHost *:80 DocumentRoot /var/www ServerName default.dyndns.org#Additional options here </VirtualHost <VirtualHost *:80 DocumentRoot /home/username/public_html/example1.dyndns.org ServerName example1.dyndns.org#Additional options here </VirtualHost I want to change the DocumentRoot as I am running a chrooted ProFTPd server and want to be able to update webserver files via FTP. I hope this makes sense. I am running Ubuntu 8.04 LTS Server (CLI only). |
As long as apache can read the directory and files, it will be fine. Don't forget the below section if you get 403 errors.
Code:
#WimS PS The documentroots for my virtual sites are in /home as shown below (from a Slackware box; I know ubuntu works slightly different). Code:
# |
Hi,
I would do this: Code:
# cd /home/username See ya |
Thanks, guys! I have it up an running, but it looks like I should add some lines to handle exceptions and fix some permissions.
Couple more questions I ran across when looking at some HowTos... Is there anything that needs to be added to the main apache2.conf file to enable virtual hosts or can I just add sites to the /sites-available from a fresh install? One article says I need to create a file... /etc/apache2/conf.d/virtual.conf and put the following statement in the file... Code:
# We're running multiple virtual hosts. Code:
NameVirtualHost <ip>:<Port Number> Now I added both of these statements, but noticed that I do the same thing in my virtual host files that are stored in /sites-enabled What is the correct location to add these statements? |
If you use Ubuntu, stick to articles dedicated to Ubuntu. Do not read anything else as it more than likely does not apply and therefore will confuse you.
What I posted in #2 is the vhosts.conf file as used in Slackware 12 and that's the only place where NameVirtusalHost is used. |
All times are GMT -5. The time now is 06:11 AM. |