Things seem different with 16.0. (An understatement?) What are the proper steps to set up 2 virtual hosts, say in /Develop/WebA and /Develop/WebB?
At the beginning, it looked like it wasn’t reading the .conf files as it stopped processing with /etc/apache2/conf.d/phpMyAdmin.conf on “<IfVersion < 2.4>” Renaming that so it won’t load it then brought the other problems.
Without any Yast to try to set them up, I tried manually, but it looks like it’s going to /srv/www/htdocs
error_log: AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex
> /usr/sbin/httpd -S
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:80 is a NameVirtualHost
default server WebA (/etc/apache2/vhosts.d/apache-test.conf:5)
port 80 namevhost WebA (/etc/apache2/vhosts.d/apache-test.conf:5)
port 80 namevhost WebB (/etc/apache2/vhosts.d/apache-test.conf:52)
ServerRoot: "/srv/www"
Main DocumentRoot: "/srv/www/htdocs"
Main ErrorLog: "/var/log/apache2/error_log"
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/run/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex ssl-stapling-refresh: using_defaults
PidFile: "/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="wwwrun" id=458 not_used
Group: name="www" id=459 not_used
> cat /etc/apache2/vhosts.d/apache-test.conf
#
# WebA
#
<VirtualHost *:80>
DocumentRoot /homedata/kit/Develop/WebA
ServerName WebA
ServerAdmin admin@none.none
SSLEngine On
# don't loose time with IP address lookups
HostnameLookups Off
# configures the footer on server-generated documents
ServerSignature On
<Directory /homedata/kit/Develop/WebA>
AllowOverride FileInfo Options Indexes
Require all granted
</Directory>
</VirtualHost>
#
#<VirtualHost *:443>
# DocumentRoot /homedata/kit/Develop/WebA
#
# # SSL Engine Switch:
# # Enable/Disable SSL for this virtual host.
# SSLEngine on
#
# # OCSP Stapling:
# # Enable/Disable OCSP for this virtual host.
## SSLUseStapling on
#
#
# SSLCertificateFile /etc/apache2/ssl.crt/chaduath.crt
# SSLCertificateKeyFile /etc/apache2/ssl.key/chaduath.key
#
# ServerName WebA
# ServerAdmin admin@none.no
# <Directory /homedata/kit/Develop/WebA>
# AllowOverride FileInfo Options Indexes
# Require all granted
# </Directory>
#</VirtualHost>
#
#
# WebB
#
<VirtualHost *:80>
DocumentRoot /homedata/kit/Develop/WebB
ServerName WebB
ServerAdmin none@no.no
<Directory /homedata/kit/Develop/WebB>
AllowOverride FileInfo Options
Require all granted
</Directory>
</VirtualHost>
But rather than trying to figure out how to fix this, what are the current recommended steps to set up virtual hosts?
So is there any good way of not using /srv/www/htdocs? Because that is part of my install partition which will be gone on the next OpenSUSE version. I have my /Develop on a data partition outside of the installs.
sudo cp -r /srv/ /home assuming you have /home on a separate partition and that you have the hosts in /srv now. Otherwise do:sudo mkdir -p /home/srv/www/htdocs and put your websites in there, each in their own subdirectory, f.e. dt30.us .
I’m not seeing how that’s much different than what I did.
The document root doesn’t seem to be working. It did in 15.6, 15.5, and several versions prior. But with 16.0, it looks like it’s hardcoded to /srv/www/htdocs. I placed an index.html saying, Welcome to local host, in it. But when I go to my WebA or WebB, instead of saying, Welcome to WebA, it says, Welcome to local host.
Notice the httpd -S said, ServerRoot: “/srv/www” even though my apache-test.conf has DocumentRoot /homedata/kit/Develop/WebA.
I don’t have the ServerAlias, nor the log files set differently, but I can’t imagine that is affecting the document root.
I’m thinking that what has changed is that 16.0 no longer accepts symbolic links into vhosts.d. I thought of trying it as a copied file and it looks like it’s reading it now, but with “Develop/WebA/index.html’) because search permissions are missing on a component of the path”. Which is another change of permissions possibly, which I didn’t have an issue on the older systems. I’ll have to look at it more, but at least it is reading the DocumentRoot, now.
SELinux is preventing httpd-prefork from getattr access on the file /homedata/...
What is SELinux, is that good, and should I do the recommended “semanage fcontext -a -t FILE_TYPE '/homedata/…”
And do I need to do that for every file?
This is all new stuff to me and I don’t know what I’m doing. Never was an issue in earlier versions.
I found this:
Maybe there’s something better about it, but looks like added pain.