Doc /

Installing-Apache

<-Back

Apache2

Install

Install Apache2 with yast and configure it as a running service in yast, system, run levels.

You need to restart apache after any setup change. The best way to do it is "apache2ctrl restart", because apache2ctl makes a syntax check and report very usefull infos.

External setup

Setup your Domain Name Zone for your domain name (that is make your domain name equivalent to your IP). If you have only one domain name and you need to keep contact to the old server, use subdomain. If not you can type the IP in the URL window.

Don't forget many web applications use mysql, so mysql have to be configurerd before.

Default setup

Index file

You need an index file. I advice you to place an "index.html" file in any htdocs folder you have on your computer, with a small text giving clue where it is. For example "nemo root" for /srv/www/htdocs/index.html. I couldn't make links work at the beginning of the setup, so why I need to know what is apache displaying if any. No html tag necessary at the moment.

Calling your domain name on a browser should display "nemo listening"

Htdocs location

The file /etc/apache2/default-server.conf must be also edited to give the web site location on the disk (DocumentRoot). It's necessary to at least change the

 DocumentRoot "/srv/www/htdocs"

line to the real absolute htdocs position to allow apache to find it. It's not necessary nor advised to change any other line in this file, better use vhosts.

But the best way, probably, to give a new absolute location is to keep the old one (/srv, on openSUSE) and bind mount the new location on it like this:

manually

 mount --bind /home/data/srv/ /srv

in fstab:

 /home/data/srv/     /srv        none    bind

Vhosts

The Apache config is tightly tied to virtual hosts. openSUSE places virtual hosts in /etc/apache2/vhosts. Any file ending by .conf is read, in alphabetical order. To move a server, copy these files to the new position. There is no "validation" folder as you can find in Debian based distros. Rename the file (for example remove the "f" of conf) to invalidate a file.

I don't think the read order matters. The files are read in alphabetical order. However, it seems than if the web server is called by IP (numérical) and not by name the default file used is the first read. So it may be a good idea to name local.conf "__local.conf" if it's to be the default

"local.conf" file can be setup as:

# forbid access to the entire filesystem by default
<Directory />
    Options None
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

# Configure the DocumentRoot
#
<Directory "/home/data/srv/www/htdocs">
Options FollowSymLinks Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Web Site

The default Apache Web site is in "htdocs" (very confusing for beginners).

.htaccess

For these files to work you have to keep "AllowOverride All" or similar to make .htaccess with "Order Deny,Allow Deny from all" to work and hide data files.