Wordpress installation on Nethserver (multiple vhosts)

Hi Michel-Andre,
I’m now on Chapter II/7 and have some questions.
Apache, MariaDB and PHPMyAdmin are well installed:

# systemctl list-unit-files | grep mariadb
mariadb.service                                   disabled
rh-mariadb102-mariadb.service                     enabled
rh-mariadb102-mariadb@.service                    disabled

systemctl list-unit-files | grep httpd
httpd-admin-reload.service                       static
httpd-admin.service                              enabled
httpd.service                                    enabled
httpd-admin-reload.timer                         static

# chown -R apache:apache /var/wwww/ is done, but the next command fails

ls -alsd /var/wwww/html/
ls: cannot access /var/wwww/html/: No such file or directory

But the directory really exists and root should be able to list it.

For my vhostes directory this works fine.

# ls -alsd /var/lib/nethserver/vhost/a2...47d/
0 drwxr-sr-x 2 ftp apache 6 Oct  5 17:29 /var/lib/nethserver/vhost/a2....7d/

As I want to assign my installations to different vhosts, the question occurs whether it is sufficient to replace the default path with the vhost path /var/lib/nethserver/vhost/##random_number##/ for the application of your manual.
Or must be aware of other specific conditions?

@capote

Hi

Ist da ein Typo ( wwww ???) oder soll es so heissen?

Gruss
Andy

Hi Andy, indeed…typo.
Even if I look at the input three times, I do not recognize it. This must be the age

[root@srv01 ~]# ls -alsd /var/www/html/
0 drwxr-xr-x. 3 root root 25 Oct 5 16:52 /var/www/html/
[root@srv01 ~]#

Thank you, Marko

The eyes correct such mistakes, not everything is age! :slight_smile:

1 Like

You are so charming :smiley:

@michelandre
What means the abbreviation BD (like in “Pour l’usager de la BD de WordPress”) ?
DeepL translates it to " WordPress-Comic-User" :laughing:

‘BD’ means ‘base de données’ => mysql database

I presume

1 Like

I should be ready for the initial WordPress-start up after finishing chapter II/8.4

https://vhost-domain.name.tld/wp-admin/install.php
But I get Error 500. :weary:

Check httpd error logs and folders/files permission

Hi Marko,

● It is the html directory:
chown -R apache:apache /var/www/html

● Exactly

● I do not know why you have a random number for the name of the folder for the vhost.
/var/lib/nethserver/vhost/##random_number##/

image
It should be:
/var/lib/nethserver/vhost/devnet/
the Name (Nom) you gave to the vhost.
→ Use only standard alphabetic letters without spaces or special characters.

● For the installation, it should be:
https://vhost-domain.name.tld/
and it will change to:
https://vhost-domain.name.tld/wp-admin/install.php

● Do you have an entry vhost-domain.name.tld in the hosts file of your workstation.
If so, then clear the cache of the workstation:
ipconfig /flushdns
and also clear the one of the browser.

EDITION:
Change the owner:group of the /var/lib/nethserver/vhost/devnet directory for apache: apache, otherwise you will have difficulty updating WordPress.

chown apache:apache /var/lib/nethserver/vhost/devnet

Michel-André

Error 500 fixed:
.htaccess: RewriteRule “translated” to RewriteRegel

But now I have only white space within the browser:
AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive

So the webserver tries to deliver from the default directory, although I used my vhost directory for the configuration.
So I have to check all configuration files again, if there is an artifact somewhere in there.

yes, I did it so, but I will check again.

Hi Marko,

● White page with WordPress means an error in configuration somewhere.

● Folder /var/www/html/ is for the standard NS web page (here it will be for the standard WordPress).

For the vhost, it should be: /var/lib/nethserver/vhost/devnet. (replace devnet by the name of the vhost)

● Do not translate the commands.

● Also, the icon indicates that the command is on one line. The PDF will put it on two lines with a [CR] [LF] between them. It will therefore be necessary to copy the entire command in an ASCII text editor and reduce it to a single line before copying / pasting it at the console.
image

Michel-André

My investigation has shown that I probably have to change some additional parameters in the http.conf tip point to my virtual host.

DocumentRoot “/var/lib/nethserver/vhost/a5…7d/”

<Directory “/var/www”> <<—???
AllowOverride None
# Allow open access:
Require all granted

Further relax access to the default document root:
<Directory “/var/www/html”>. <-----??
ScriptAlias /cgi-bin/ “/var/www/cgi-bin/”. <—?

and may others too

Hi Marko,

● This will control the access to .htaccess
III-6. httpd.conf file
The /etc/httpd/conf/httpd.conf file contains all of the directives that control the httpd daemon. The one that has the most influence on the .htaccess files in the /var/www/html directory and its subdirectories is the AllowOverride directive on line 151 of the daemon configuration file.
By default, this directive is None and causes the httpd daemon to not process any .htaccess files it finds; he will ignore them all.
Later, in the .htaccess file in the WordPress root directory, we will add directives to change the Permalinks so that WordPress displays the name of the page instead of just displaying their number. With these directives, Wordpress will search for pages that have the Post Title suffix, but will not find them, because httpd will not use the .htaccess file. WordPress will think the permalink is set to Post Title while by default they are set to Simple. It will then display the message “Page not found”, because it cannot locate the page with the Post Title suffix.

EDITION:
Make sure the modification is under <Directory “/var/www/html”>
This will affect the access to /var/www/html/.htaccess.

● XIII-9 for the vhost
You can install a new WordPress in the directory /var/lib/nethserver/vhost/devnet (adjust devnet) by following the same procedures as those used previously, but using FQDN of the vhost and a new MariaDB database 10.2.
It is absolutely necessary to add the lines below at the end of the 2nd WordPress wp-config.php file.

if(is_admin()){
    add_filter('filesystem_method', create_function('$a', 'return "direct";' ));    
    define( 'FS_CHMOD_DIR', 0751 );
}

● Maybe you should create a new vhost and see if it will give “funny-number” to the name of the directory.

Michel-André

“/var/lib/nethserver/vhost/a5…7d/”
and
<Directory “/var/www”>

This is wrong, the first one is for the vhost and the second one is for the default NS web page (the default WordPress). Those are not related at all.

Michel-André

The creation of a vhost will create a conf file for it: (/etc/httpd/conf.d/virtualhosts.conf) that will be added to the standard httpd.conf and it will restart httpd.

In the created conf file for the vhost, NS will add the directive:
AllowOverride All
and this directive will give access to the .htaccess file in the vhost directory.
There is nothing to change in that new created file.

Michel-André

A lot to think about. I have not yet reached chapter XIII. While implementing the instructions in Chapter II/III I replaced the default directory with my vhost directory. Was that overhasty?
Thanks, Marko

The only change to the httpd.conf is the modification of:

AllowOverride None
to
AllowOverride All

Make sure the modification is under <Directory “/var/www/html”>

Nothing else to change in that file.

Michel-André

Don’t worry. Going through the document, you will see almost everything about WordPress and will be a pro.

Michel-André