TurnKey Linux Virtual Appliance Library

/var/www is hidden in MySql Appliance

1bac2754175c08a2's picture

I want to modify your MySql appliance to run an own web application.

I put my files (including a index.html) into /var/www. (It is a small PHP-app using mysql.)

When I call my appiance via browser, I always get PhpMyAdmin. The content of /var/www is completely hidden.

As a workaround, I can run

/usr/sbin/lighty-disable-mod phpmyadmin
/etc/init.d/lighttpd force-reload

to get my own application running, but that means, that PhpMyAdmin is no longer available.

What do I need to do to access both without reconfigurating lighty?

Jeremy Davis's picture

You'd be better off with TKL LAMP wouldn't you?

TKL LAMP is designed as a web server, TKL MySQL appliance is designed as a database server (which is probably why /var/www/ is hidden! Not that what you want isn't possible (it should still be) but TKL LAMP will probably cause you less problems.

Reiner Müller's picture


Maybe, but I don't want a LAMP system. It is told to be insecure on the web and my package intentionally has been migrated away from LAMP.

What is the reason for hiding /var/www? How to get rid of that feature?

Jeremy Davis's picture

Just a thought...

If PhpMyAdmin is working then the TKL MySQL appliance must have some sort of webserver already configured? Perhaps this is conflicting or over-riding the Lighttpd (I assume thats what you mean by lighty) installation? I'm not sure how you would go about sidestepping this issue, you will probably need to speak with one of the Devs.

If you specifically want a LLMP (Linux Lighttpd MySQL Php) server perhaps you would be better configuring it yourself from scratch (ie TKL Core with the others installed on top). If you document your progress and/or use TKLPatch then the chances of TKL producing and supporting the appliance you want are increased (at the speed with which you are likely to see it also).

[edit] Apache should not be a security problem (as long as security patches are up to date - FYI they are applied automatically on TKL LAMP) although it can be fairly high on resource usage (compared to Lighttpd anyway). Unless you meant your app has security issues when run on Apache which for some reason aren't available for exploitation when run on Lighttpd?

Alon Swartz's picture

MySQL appliance is configured as a database server

As JedMeister mentioned above, the MySQL appliance is configured as a database server, not a web server. MySQL is configured to listen on all interfaces and accept connections from all hosts, as opposed to LAMP in which MySQL listens on localhost.

Lighttpd is only included to power phpmyadmin, and was never meant to act as a webserver, thats why /var/www is not configured as you would expect.

If you really want, and are comfortable with the cli (there is no webmin lighttpd module), you can configure /etc/lighttpd.conf to also listen on 80/443 with /var/www as its documentroot, but the path of least resistance would be LAMP.
Reiner Müller's picture

TKL Core <--> TKL MySql

Thanks for your replies.

I started to configure TKL Core for my app. I've run these commands:

apt-get update
apt-get install lighttpd mysql-server php5 phpmyadmin

and apt-get surprisingly stated, that all 4 packages are still installed and up to date, so it seems to be a pure configuration problem.


But back to TKL MySql:

  • Port 80 is the default port of lighttpd to listen, so I guess, that there is no need to specify it.
  • lighttpd.conf contains server.document-root = "/var/www/" so it should see my app

/usr/sbin/lighty-disable-mod phpmyadmin simply removes a link in /etc/lighttpd/conf-enabled. That is sufficient, to unhide /var/www for the server.

Looks like PhpMyAdmin is responsible for hiding /var/www. Strange.

Conclusion: The idea to use TKL MySql for my project does'n seem to be so bad...

Edit: One more surprise: There is a running apache2 on TKL Core

Alon Swartz's picture

Shedding some light on phpmyadmin lighttpd configuration

It doesn't make sense that attempting to install those packages in turnkey core would say that they are already installed, as they aren't. Maybe you did the apt-get install on turnkey mysql?

Anyway, regarding the "hidden /var/www" issue you mentioned, /etc/phpmyadmin/lighttpd.conf defines server.document-root, so it takes precedence over the default /var/www. You could update the phpmyadmin lighty configuration to listen on a different port, eg. 12322

Just a reminder, if you end up going with turnkey mysql, you should update the configuration to not listen on all interfaces and accept remote connections.

Good luck!
Reiner Müller's picture

My fault, sorry

You are right. Nothing is installed in TKL Core.

Reiner Müller's picture

Success with Disadvantage

OK, I succeeded to configure TKL Core for my needs.

After running

apt-get update
apt-get install lighttpd mysql-server php5 phpmyadmin

Apache2 and lighty was installed. Apache is responsible for /var/www and everything works fine.

Disadvantage: the bz2'ed appliance has 207 MB instead of 137 MB for the modified MySQL-VM.

Thanks for your help.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)