Problems with Apache Virtual Host


 
Thread Tools Search this Thread
Top Forums Web Development Problems with Apache Virtual Host
# 15  
Old 01-20-2014
I removed all NameVirtualHosts from my virtualhosts. There appears to be one in the /etc/apache2/ports.conf however. Should I edit it there?

[edit] Edited there. No difference.

Whenever I try to subdomain my site I get warnings like
Code:
[Mon Jan 20 10:46:38 2014] [warn] VirtualHost lmcmg.mysite.com:80 overlaps with VirtualHost mysite.com:80, the first has precedence, perhaps you need a NameVirtualHost directive

...but adding a NameVirtualHost does not help. Sometimes I can get it to stop printing the warning, but it still overrides everything, not just the URLs I wanted.

Last edited by Corona688; 01-20-2014 at 12:57 PM..
# 16  
Old 01-20-2014
I edited previous post please see.
# 17  
Old 01-20-2014
Let me explain my exact situation.

I have wordpress installed in /usr/share/wordpress, shared. I also have a few user-modifiable directories in /srv/www/wp-content/lmgmg.sitename.com/uploads and so forth.

I am hoping to be able to define mysite.com with a documentroot of /usr/share/wordpress, and alias /wp-content/uploads into the various /srv/www/wp-content/site/uploads directories individually. So far, I can't alias /wp-contents/uploads individually, only globally.
# 18  
Old 01-20-2014
OK, let me show you exactly what I have right now:

/etc/apache2/sites-enabled/default:
Code:
NameVirtualHost localhost:80

<VirtualHost localhost:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        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

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

/etc/apache2/sites-enabled/mysite.com:
Code:
<VirtualHost mysite.com:80>
        ServerName mysite.com
        DocumentRoot /usr/share/wordpress
        alias /wp-content/uploads /srv/www/wp-content/lmcmg.lakeshoremed.ca/uploads
</VirtualHost>

<VirtualHost mysite.com:80>
        ServerName mysite.com
        DocumentRoot /usr/share/wordpress
</VirtualHost>

Every other apache configuration file has been left at ubuntu defaults.

When I start apache with this exact configuration I get these warnings:

Code:
# /etc/init.d/apache2 restart * Restarting web server apache2                                                apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Mon Jan 20 11:10:17 2014] [warn] VirtualHost lmcmg.mysite.com:80 overlaps with VirtualHost mysite.com:80, the first has precedence, perhaps you need a NameVirtualHost directive
[Mon Jan 20 11:10:17 2014] [warn] NameVirtualHost *:80 has no VirtualHosts
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Mon Jan 20 11:10:18 2014] [warn] VirtualHost lmcmg.mysite.com:80 overlaps with VirtualHost mysite.com:80, the first has precedence, perhaps you need a NameVirtualHost directive
[Mon Jan 20 11:10:18 2014] [warn] NameVirtualHost *:80 has no VirtualHosts
                                                                         [ OK ]
#

I get /wp-content/uploads overrided for every subdomain inside mysite.com, not just lmcmg.

Last edited by Corona688; 01-20-2014 at 01:21 PM..
# 19  
Old 01-20-2014
I did not read the entire thread, but normally with apache, each virtual host is defined in it's on file in the directory:

Code:
/etc/apache2/sites-available

Then you make a symlink to the file(s) in that directory from:

Code:
/etc/apache2/sites-enabled

When I read (maybe too quickly) though the thread, it seems you were trying to create a new virtual host with the configuration file of an existing virtual host. If that's not the case, I apologize; as I only quickly glanced over the thread.

For example,

Code:
/etc/apache2/sites-available/my.great.site.com
/etc/apache2/sites-available/my-other.great.site.com

Then you symlink to these files, something like:

Code:
/etc/apache2/sites-enabled/site1 -> ../sites-available/my.great.site.com
/etc/apache2/sites-enabled/site2 -> ../sites-available/my-other.great.site.com

There are apache2 commands to do this for you.

Then restart of course. (service apache2 restart)

Each virtual host we keep in a separate file... I have one apache2 server with 15 sites like this.

Hope this helps.
# 20  
Old 01-20-2014
Hm. I'll try splitting that one with two vhosts.
# 21  
Old 01-20-2014
Quote:
Originally Posted by Corona688
Hm. I'll try splitting that one with two vhosts.
It's the only way I ever do it... over many years.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Apache Virtual host issue

Hello, I am facing a very strange issue while setting a virtual host on apache to setup multiple websites using separate IPs. Virtual host is setup but when i am browsing the website it display content under /var/www/html and displaying site1 and site2 folder instead of access the content... (2 Replies)
Discussion started by: sunnysthakur
2 Replies

2. Solaris

Solaris 10 virtual - how do I tell physical host?

uname -a reports type Generic so I know its virtual. Assume its an ldom somewhere. How do I find out what physical host server is? (4 Replies)
Discussion started by: psychocandy
4 Replies

3. Red Hat

Apache virtual host config vs global config problem

Hi folks, I am trying to configure Apache webserver and also a virtual host inside this webserver. For Global server config: /var/www/html/index.html For virtual host config: /var/www/virtual/index.html Both client10 & www10 are pointing to 192.168.122.10 IP address. BUT, MY... (1 Reply)
Discussion started by: freebird8z
1 Replies

4. Red Hat

Apache question - virtual host related

Hi folks, I recently read about Apache virtual host and was able to configure that as well. I used name based virtual host (lets say http://vhost1.example.com) and it worked just fine. Then I configured another named based virtual host on same apache server (lets say http://vhost2.example.com)... (2 Replies)
Discussion started by: freebird8z
2 Replies

5. Solaris

Change hostID of Solaris 10 virtual/guest machine installed by Virtual Box 4.1.12 on Windows-XP host

Trying to set or modify the randomly set hostID of a Solaris 10 virtual/guest machine that I installed on a Windows-XP host machine (using Virtual Box 4.1.12). I was able to set/modify the hostname of the Solaris 10 virtual/guest machine during installation as well as via the Virtual Box... (4 Replies)
Discussion started by: Matt_VB
4 Replies

6. Red Hat

Virtual Host Apache

Hi, I have set up the following virtual host but it cannot find the URL? Apache is running fine and I have disabled iptables. Within the document root I have the following file index.html displaying a sample text message. Any ideas what my problem might be? httpd.conf: ... (2 Replies)
Discussion started by: Duffs22
2 Replies

7. Solaris

Unix virtual host detection

Is it possible to reliably detect the virtual host of a Sun Solaris box, within a shell or Perl script? Can a system have multiple virtual host or not host at all ? I was recently made aware of hostname command, but was not sure if this option was the only one available. Any help is much... (3 Replies)
Discussion started by: Meridian
3 Replies

8. Solaris

Unix virtual host detection

I have a need to write scripts that can reliably determine the virtual host of a Sun Solaris system. (1 Reply)
Discussion started by: Meridian
1 Replies

9. UNIX for Advanced & Expert Users

Resolving Aliases and Virtual IP's on a Host

I am currently going through the servers in our network and trying to compile a list of the current aliases for each box and any virtual IP addresses. I can check for the ones that are supposed to be there but how do I list the ones that I don't even know exist? ANY help would be greatly... (1 Reply)
Discussion started by: Scott Pullen
1 Replies

10. UNIX for Dummies Questions & Answers

Apache virtual host

Would this be the correct entry for Apache to answer on the IP 129.250.242.126 if the servers IP is 129.250.242.125? Are any other changes necessary to get Apache to answer this IP for web traffic? < VirtualHost 129.250.242.126> ServerName www.my_domain.com ServerAdmin admin@my_domain.com... (4 Replies)
Discussion started by: 98_1LE
4 Replies
Login or Register to Ask a Question