see also this page.
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.
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.
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".
Apache modules are the mod_XXX, for example mod_rewrite, and give access to system variables like RewriteEngine.
The way these modules are setup varies among linux distributions, so what is done for openSUSE do not match necessary what is done for Debian.
openSUSE installs all (or most) modules by default, but do not activate all of them. The activation is done by adding the module name in /etc/sysconfig/apache, but this is not carved in stone, so better use the prefered way, that is ise
to enable the module or
to disable it.
This changes the file /etc/apache2/sysconfig.d/loadmodule.conf. It's seriously discouraged to manipulate this file yourself, as things may change and this file desapear without notice.
It's also possible to use YaST, but I found the YaST httpd module very agressiven that is if you use it, do not try to change anything by hand. Do not mix YaST and vi on a config.
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
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:
mount --bind /home/data/srv/ /srv
/home/data/srv/ /srv none bind
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 default DocumentRoot # <Directory "/home/data/srv/www/htdocs"> Options FollowSymLinks Includes AllowOverride All Order allow,deny Allow from all </Directory>
The default Apache Web site is in "htdocs" (very confusing for beginners).
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.
test the syntax.
also allows to test the web site, but then you have to use
before the normal
systemctl start apache.service
to make the system works normally.