Installing Apache

Installing Apache is very straight forward. I’m doing this as root. If you are not root precede each command with sudo

Type:

zypper in apache2

If your OpenSuSE firewall is active (mine is not) you will need to punch holes for port 80 and 442. This can be done via the following commands

sysconf_addword /etc/sysconfig/SuSEfirewall2 FW_CONFIGURATIONS_EXT apache2

sysconf_addword /etc/sysconfig/SuSEfirewall2 FW_CONFIGURATIONS_EXT apache2-ssl

rcSuSEfirewall2 restart        #This restarts the firewall service so the change takes effect.

Next we need to enable apache to start at boot so that our website is automatically served when the server powers on

rcapache2 start

chkconfig -a apache2

And that’s all there is to it. I’m presuming you know how to configure Apache to serve your websites. I’m no expert so I wouldn’t presume to tell anyone else how to do it.

My one gotcha that was not config related and was preventing apache from serving my sites was this.

The default DocumentRoot is /srv/www/htdocs and it's owned by root.

The default account apache runs under is wwwrun in the group www

Therefore make sure that your website files can be read by wwwrun

I changed the DocumentRoot in the default-server.conf file located in /etc/apache2 to

DocumentRoot "/srv/www/htdocs/Websites/"

and then changed the owner of the DocumentRoot to wwwrun - this allowed the webpages to be served which wasn't happening before.

chown -R wwwrun:www /srv/www/htdocs/Websites/

This fixed the issue.

Also, I generate my web content on my Mac and then copy it to the DocumentRoot on the OpenSuSE server using rsync. To stop the source file permissions from overriding the target i use the  -rv switch to maintain the existing permissions.

rsync -rv /<new_web_content_location>/ <username>@<webserver>:/srv/www/htdocs/Websites

© Charles Webster 2016