3

I have an Apache server installed with Debian. Later, I partitioned my hard drive and installed Ubuntu on the new partition. Afterwards, I realized I could not access my Apache server while booted into Ubuntu.

How can I make it so the Apache server is accessible over the Internet no matter which partition I am booted into?

Or is that even possible?

2

I cannot recommend sharing the apache server, unless you are really in a tight spot regarding disc space: the Debian and Ubuntu distribution would have to be very close for that to work (as Apache depends on each of the distros on other libraries).

If you can install Apache on Ubuntu then it is very doable to share the content between the different implementations, and that could also be true if that content is dynamically generated e.g. with software like django or web2py.

For the content to be shareable, you have to mount the Debian disc in Ubuntu. And then have the configuration of Apache on Ubuntu point to the Debian partition. This in general can be done by editing /etc/apache2/sites-enabled/000-default on the Ubuntu system and have the entries match those of the setup on Debian, except for all the paths, which should be prefixed with the location where the Debian partition is mounted on the Ubuntu system

If this is not possible (because of hardcoded paths in the dynamic content software, you can try to make soft links from the Ubuntu directories to their equivalent on the Debian partition. In this case you have to make sure that Apache follows SymLinks, as I don't think it does that by default. This can be achieved e.g. if the Debian partition is mounted on /mnt/deb and the location of the content on Debian was on /srv/mysite by doing:

cd /srv
ln -s //mnt/deb/srv/mysite .

If you don't want to make the links, you can try to mount -o bind the Apache content directory on the Debian partition to the equivalent directory on your Ubuntu installation. This can be done, assuming the same configuration as with the example above by doing:

cd srv
mkdir mysite
mount -o bind /mnt/deb/srv/mysite mysite

I have not done this between Ubuntu and Debian, but I have between versions of Ubuntu 8.04, 10.04 and 12.04 in the process of gradual upgrading with the possibility of switching back to the old software.

2
  • I already have the debian partition mounted in Ubuntu, but how could I set the configuration of Apache on Ubuntu to point to the Debian partition? Feb 9 '14 at 20:06
  • That depends a lot on your configuration and if these are static files. I will update my answer to give examples for each of the 3 options.
    – Timo
    Feb 9 '14 at 20:12
0

Both systems likely use a similar directory structure (eg. /var/www), so getting content to appear in each is a simple matter of mounting the correct partition, and either making a symlink or using a bind mount (eg. mount --bind <debian dir> <ubuntu dir>) (I recommend a symlink so the server will fail if the debian partition isn't mounted.)

Using the same configuration under both systems will be a lot more tricky, as the server can have numerous components outside it's direct control (php, python, perl, mysql, etc.), and each distro could be using different versions of every component.

If your site is simple, and relatively static, manually setting up both system and remembering to make any changes in both is an option. For a simple home user, this may be an acceptable headache. But for a site people use -- and depend on, you really should pick a system and stay with it.

0

None of the answers above solve the issue; in fact, the problem is related to Apache itself, not filesystem or permissions.

The only thing you need to do to solve the issue is the following:

<Directory "/www/mywebdirectoryinapartitioneddisk">
    Require all granted
</Directory>

Here is a blog post in which I explain everything in-detail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.