Vhosting question

Discussion in 'Server Operation' started by satimis, Apr 17, 2011.

  1. satimis

    satimis New Member

    Hi folks

    host - ubunut 1010 desktop 64bit
    virtualizer - VirtualBox ver 3.2.10 r66523
    guest (VM) - ubuntu 1010 server 64bit

    I followed;
    Creating Simple Virtual Hosts With mod_mysql_vhost On Lighttpd
    http://www.howtoforge.com/creating-simple-vhosts-with-mod_mysql_vhost-on-lighttpd-debian-etch

    to setup virtual hosting.

    example.com = a registered domain
    example.org = a free subdomain on "http://freedns.afraid.org/subdomain/"
    (I don't have another registered domain for this testing)

    Both domain points to the same public IP. The public IP is also forwarded to the local IP of the VM.

    Installation went through w/o much problem. After finish "example.com" works without problem. However example.org can't be browsed.

    On console ping both domains working.

    Please shed me some light where to check? TIA

    B.R.
    satimis
     
    Last edited: Apr 17, 2011
  2. falko

    falko Super Moderator

    Are there any errors in the Lighttpd error log?
     
  3. satimis

    satimis New Member

    Hi falko,

    No. Your How-to is perfect. What made me spending hours without a breakthrough is the subdomain registered on;

    http://freedns.afraid.org/

    I can ping the subdomain registered but can't browse it. On their website the subdomain is pointing on the public IP (fixed) which in turn is forwarded to the local IP of the VM under testing. I googled around on Internet for cause in parallel generating a suspicion that vhosting on lighttpd doesn't work on VM or not supporting vhosting on subdomain. I was stuck there. Then by chance I registered anther subdomain on;

    http://changeip.net/

    and set up the vhost according to the steps described on your How-to. It works seamlessly.

    I still don't understand the cause of the first subdomain not working on lighttpd.

    Thanks

    Edit:

    I'm now creating another VM according to your How-to to see what will happen.


    B.R.
    satimis
     
  4. satimis

    satimis New Member

    Hi falko,

    Have another round.

    I'm stuck here;

    1)
    if
    bind-address = 127.0.0.1

    $ mysqladmin -h hostname -u root -p password mysqlpasswd
    Enter password:
    Code:
    mysqladmin: connect to server at 'hostname' failed
    error: 'Lost connection to MySQL server at 'reading initial communication packet', system error: 111'
    
    2)
    if
    bind-address=VM_local-IP
    $ mysqladmin -h hostname -u root -p password mysqlpasswd
    Enter password:
    Code:
    mysqladmin: connect to server at 'hostname' failed
    error: 'Host 'hostname.satimis.com' is not allowed to connect to this MySQL server'
    
    hostname is gererated by

    $ hostname
    or
    $ hostname -a
    both output being the same

    NOT hostname.satimis.com (I can't resolve?)

    Referring to previous notes setting the lighttpd server I have the same problem. Therefore I haven't created mysqladmin password.

    Advice would be appreciated. TIA

    B.R.
    satimis
     
  5. falko

    falko Super Moderator

    Comment out the bind-address line and restart MySQL. Then run
    Code:
    dpkg-reconfigure mysql-server
    This hsould ask you to set a password.


    The domain must point directly to your router's public IP.
     
  6. satimis

    satimis New Member

    Comment out the line
    Code:
    bind-address = 127.0.0.1
    
    # service mysql restart
    Code:
    mysql start/running, process 1367
    
    # netstat -tap | grep mysql
    Code:
    tcp        0      0 *:mysql                 *:*                     LISTEN      1367/mysqld
    
    # dpkg-reconfigure mysql-server
    no printout (no response)

    Yes, on http://freedns.afraid.org/ website. The domain(subdomain) points to the public IP of the router.

    Just create a new vhost for it. Still I can't browse it. Other domain and subdomain work without problem.

    satimis
     
  7. falko

    falko Super Moderator

    Can you post the output of
    Code:
    ifconfig
    and the vhost configuration of the not-working vhost?

    Can you connect to MySQL if you leave out the
    Code:
    -h hostname
    part?
     
  8. satimis

    satimis New Member

    ifconfig
    Code:
    br0       Link encap:Ethernet  HWaddr 08:00:27:04:a9:83  
              inet addr:xxx.xxx.xxx.xxx  Bcast:x.x.x.255  Mask:255.255.255.0
              inet6 addr: fe80::a00:27ff:fe04:a983/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:2999 errors:0 dropped:0 overruns:0 frame:0
              TX packets:2250 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:257698 (257.6 KB)  TX bytes:1588019 (1.5 MB)
    
    eth0      Link encap:Ethernet  HWaddr 08:00:27:04:a9:83  
              inet6 addr: fe80::a00:27ff:fe04:a983/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:8073 errors:0 dropped:0 overruns:0 frame:0
              TX packets:3045 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:3387463 (3.3 MB)  TX bytes:1640493 (1.6 MB)
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    mysql> SELECT domain from domains;
    Code:
    +---------------------------+
    | domain                    |
    +---------------------------+
    .....
    | www.satimis.strangled.net |
    +---------------------------+
    
    mysql> SELECT docroot from domains;
    Code:
    +-----------------------------------------+
    | docroot                                 |
    +-----------------------------------------+
    ....
    | /var/www/www.satimis.strangled.net/web/ |
    +-----------------------------------------+
    
    $ sudo ls -al /var/www/www.satimis.strangled.net/web/
    total 12
    Code:
    drwxr-xr-x 2 root root 4096 2011-04-19 22:19 .
    drwxr-xr-x 3 root root 4096 2011-04-19 22:16 ..
    -rw-r--r-- 1 root root   26 2011-04-19 22:19 index.html
    
    Yes.

    $ mysql -u root -p
    Enter password:

    satimis
     
  9. falko

    falko Super Moderator

    I mean the vhost configiration file in the /etc/apache2/sites-available/ directory. Does it use the same IP address that is allocated to br0?


    This means that hostname is not listed in the mysql.user table. You're probably using a wrong hostname. Please check the mysql.user table.
     
  10. satimis

    satimis New Member

    Sorry, I'm testing lighttpd here

    $ ls /etc/lighttpd/conf-available/
    Code:
    05-auth.conf       10-fastcgi.conf  10-simple-vhost.conf  10-userdir.conf
    10-access.conf     10-no-www.conf   10-ssi.conf           15-fastcgi-php.conf
    10-accesslog.conf  10-proxy.conf    10-ssl.conf           90-debian-doc.conf
    10-cgi.conf        10-rrdtool.conf  10-status.conf        README
    
    Which file I have to check? Thanks.

    mysql> USE mysql;

    mysql> SHOW tables;
    Code:
    +---------------------------+
    | Tables_in_mysql           |
    +---------------------------+
    | columns_priv              |
    | db                        |
    | event                     |
    | func                      |
    | general_log               |
    | help_category             |
    | help_keyword              |
    | help_relation             |
    | help_topic                |
    | host                      |
    | ndb_binlog_index          |
    | plugin                    |
    | proc                      |
    | procs_priv                |
    | servers                   |
    | slow_log                  |
    | tables_priv               |
    | time_zone                 |
    | time_zone_leap_second     |
    | time_zone_name            |
    | time_zone_transition      |
    | time_zone_transition_type |
    | user                      |
    +---------------------------+
    23 rows in set (0.00 sec)
    

    mysql> SHOW COLUMNS FROM user;
    Code:
    +-----------------------+-----------------------------------+------+-----+---------+-------+
    | Field                 | Type                              | Null | Key | Default | Extra |
    +-----------------------+-----------------------------------+------+-----+---------+-------+
    | Host                  | char(60)                          | NO   | PRI |         |       |
    | User                  | char(16)                          | NO   | PRI |         |       |
    | Password              | char(41)                          | NO   |     |         |       |
    | Select_priv           | enum('N','Y')                     | NO   |     | N       |       |
    | Insert_priv           | enum('N','Y')                     | NO   |     | N       |       |
    | Update_priv           | enum('N','Y')                     | NO   |     | N       |       |
    | Delete_priv           | enum('N','Y')                     | NO   |     | N       |       |
    | Create_priv           | enum('N','Y')                     | NO   |     | N       |       |
    | Drop_priv             | enum('N','Y')                     | NO   |     | N       |       |
    | Reload_priv           | enum('N','Y')                     | NO   |     | N       |       |
    | Shutdown_priv         | enum('N','Y')                     | NO   |     | N       |       |
    | Process_priv          | enum('N','Y')                     | NO   |     | N       |       |
    | File_priv             | enum('N','Y')                     | NO   |     | N       |       |
    | Grant_priv            | enum('N','Y')                     | NO   |     | N       |       |
    | References_priv       | enum('N','Y')                     | NO   |     | N       |       |
    | Index_priv            | enum('N','Y')                     | NO   |     | N       |       |
    | Alter_priv            | enum('N','Y')                     | NO   |     | N       |       |
    | Show_db_priv          | enum('N','Y')                     | NO   |     | N       |       |
    | Super_priv            | enum('N','Y')                     | NO   |     | N       |       |
    | Create_tmp_table_priv | enum('N','Y')                     | NO   |     | N       |       |
    | Lock_tables_priv      | enum('N','Y')                     | NO   |     | N       |       |
    | Execute_priv          | enum('N','Y')                     | NO   |     | N       |       |
    | Repl_slave_priv       | enum('N','Y')                     | NO   |     | N       |       |
    | Repl_client_priv      | enum('N','Y')                     | NO   |     | N       |       |
    | Create_view_priv      | enum('N','Y')                     | NO   |     | N       |       |
    | Show_view_priv        | enum('N','Y')                     | NO   |     | N       |       |
    | Create_routine_priv   | enum('N','Y')                     | NO   |     | N       |       |
    | Alter_routine_priv    | enum('N','Y')                     | NO   |     | N       |       |
    | Create_user_priv      | enum('N','Y')                     | NO   |     | N       |       |
    | Event_priv            | enum('N','Y')                     | NO   |     | N       |       |
    | Trigger_priv          | enum('N','Y')                     | NO   |     | N       |       |
    | ssl_type              | enum('','ANY','X509','SPECIFIED') | NO   |     |         |       |
    | ssl_cipher            | blob                              | NO   |     | NULL    |       |
    | x509_issuer           | blob                              | NO   |     | NULL    |       |
    | x509_subject          | blob                              | NO   |     | NULL    |       |
    | max_questions         | int(11) unsigned                  | NO   |     | 0       |       |
    | max_updates           | int(11) unsigned                  | NO   |     | 0       |       |
    | max_connections       | int(11) unsigned                  | NO   |     | 0       |       |
    | max_user_connections  | int(11) unsigned                  | NO   |     | 0       |       |
    +-----------------------+-----------------------------------+------+-----+---------+-------+
    39 rows in set (0.00 sec)
    

    mysql> SELECT Host from user;
    Code:
    +-----------------------+
    | Host                  |
    +-----------------------+
    | 127.0.0.1             |
    | localhost             |
    | localhost             |
    | localhost             |
    | localhost.localdomain |
    | ub1010ser02           |
    +-----------------------+
    6 rows in set (0.00 sec)
    
    $ hostname
    Code:
    ub1010ser02
    
    $ hostname -a
    Code:
    ub1010ser02
    
    $ hostname -f
    Code:
    ub1010ser02.satimis.com
    
    $ mysql -h ub1010ser02 -u root -p
    Code:
    Enter password: 
    ERROR 1130 (HY000): Host 'ub1010ser02.satimis.com' is not allowed to connect to this MySQL server
    
    $ mysql -h ub1010ser02.satimis.com -u root -p
    Code:
    Enter password: 
    ERROR 1130 (HY000): Host 'ub1010ser02.satimis.com' is not allowed to connect to this MySQL server
    
    satimis
     
    Last edited: Apr 22, 2011

Share This Page