Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 29

Thread: Problems with LAMP Virtual Hosts

  1. #11
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Problems with LAMP Virtual Hosts

    Check to make sure that what you have in ServerName matches the shortcut you actually put into /etc/hosts. If they do not match, then you will automatically get served the default site instead of the one you want. Making sure that ServerName is in harmony with /etc/hosts fixed the problem with my copies of your config files.

  2. #12
    Join Date
    Jun 2009
    Location
    Little Rock, Arkansas
    Beans
    190
    Distro
    Ubuntu 12.04 Precise Pangolin

    Smile Re: Problems with LAMP Virtual Hosts

    That's a great effort. Thanks.

  3. #13
    Join Date
    Jun 2009
    Location
    Little Rock, Arkansas
    Beans
    190
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Problems with LAMP Virtual Hosts

    This is my current /etc/host file,
    Code:
    127.0.0.1    localhost
    127.0.1.1    hpc
    
    # The following lines are desirable for IPv6 capable hosts
    ::1     ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    I didn't do anything to this file previously, and I'm not sure what change
    you want me to make now.

  4. #14
    Join Date
    Jun 2009
    Location
    Little Rock, Arkansas
    Beans
    190
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Problems with LAMP Virtual Hosts

    I added the line
    Code:
    67.167.150.157 rjs357.com
    to my /etc/hosts and restarted apache. No help.

    /etc/www/default/ still show up as document root in http://rjs357.com/phpinfo.php.
    67.167.150.157 is my ip address and it shows up in http://rjs357.com/phpinfo.php as
    REMOTE_ADDR and SERVER_ADDR, though I haven''t specified my ip anywhere
    in my apache configurations.

  5. #15
    Join Date
    Jun 2009
    Location
    Little Rock, Arkansas
    Beans
    190
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Problems with LAMP Virtual Hosts

    This works!
    My ports.conf contains
    Code:
    NameVirtualHost *:80
    Listen 80
    So I guessed the change <VirtualHost *> to <VirtualHost *:80> in both my
    default and rjs357 virtual host files (which are located in /etc/apache2/sites-available).

    Does this make sense to you? Is this the best way?

    My sincere apology if this should have been obvious.

  6. #16
    Join Date
    Jun 2009
    Location
    Little Rock, Arkansas
    Beans
    190
    Distro
    Ubuntu 12.04 Precise Pangolin

    Smile Re: Problems with LAMP Virtual Hosts

    I no longer get the error "NameVirtualHost *:80 has no VirtualHosts"
    when I restart apache,
    and by changing * to *:80, as explained in my previous post,
    I've connected my virtual hosts, default and rjs357, to the settings in my ports.conf.

    Do you agree?

  7. #17
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Problems with LAMP Virtual Hosts

    Hi,

    Virtualhosts are supposed to be defined in /etc/apache2/sites-avalible/nameofvirtualhost, not /etc/apache2/ports.conf. You can add them to ports.conf but it will make it more difficult to troubleshoot issues.

    Also: I have removed your email address from your post, as it isn't really necessary to troubleshooting your config.

    Here's what one of my virtualhosts looks like:

    Code:
    charles@Precise:~$ cat /etc/apache2/sites-available/charlesa.net
    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
            ServerName charlesa.net
            DocumentRoot /home/charles/site/charlesa.net/
            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>
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  8. #18
    Join Date
    Nov 2008
    Location
    S.H.I.E.L.D. 6-1-6
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Problems with LAMP Virtual Hosts

    Quote Originally Posted by CharlesA View Post
    Hi,

    Virtualhosts are supposed to be defined in /etc/apache2/sites-avalible/nameofvirtualhost, not /etc/apache2/ports.conf. You can add them to ports.conf but it will make it more difficult to troubleshoot issues.

    Also: I have removed your email address from your post, as it isn't really necessary to troubleshooting your config.

    Here's what one of my virtualhosts looks like:

    Code:
    charles@Precise:~$ cat /etc/apache2/sites-available/charlesa.net
    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
            ServerName charlesa.net
            DocumentRoot /home/charles/site/charlesa.net/
            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>
    Quote Originally Posted by Randy Schilling View Post
    This works!
    My ports.conf contains
    Code:
    NameVirtualHost *:80
    Listen 80
    So I guessed the change <VirtualHost *> to <VirtualHost *:80> in both my
    default and rjs357 virtual host files (which are located in /etc/apache2/sites-available).

    Does this make sense to you? Is this the best way?

    My sincere apology if this should have been obvious.
    Note that the ports.conf file by default contains NameVirtualHost - you have to have it set somewhere in order to use virtual hosts. Your current setup is correct.
    It is set in there, instead of the virtual hosts to avoid confusion
    Last edited by sandyd; October 26th, 2012 at 11:02 PM.
    Don't waste your energy trying to change opinions ... Do your thing, and don't care if they like it.

  9. #19
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Problems with LAMP Virtual Hosts

    Quote Originally Posted by sandyd View Post
    Note that the ports.conf file by default contains NameVirtualHost - you have to have it set somewhere in order to use virtual hosts.
    It is set in there, instead of the virtual hosts to avoid confusion
    Makes sense. I think that was where I ran it originally, but found a good thread on it somewhere around here, but I cannot recall the name of it.
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  10. #20
    Join Date
    Nov 2008
    Location
    S.H.I.E.L.D. 6-1-6
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Problems with LAMP Virtual Hosts

    Quote Originally Posted by CharlesA View Post
    Makes sense. I think that was where I ran it originally, but found a good thread on it somewhere around here, but I cannot recall the name of it.
    I don't use apache anymore, so I wouldn't know . (/me moved to using Caucho Resin app servers)
    Don't waste your energy trying to change opinions ... Do your thing, and don't care if they like it.

Page 2 of 3 FirstFirst 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •