HowTo install Wordpress on NethServer

Another try:
I followed this procedure ( https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-centos-7 ) adapted to location of the virtual hosts and only for WordPress (from download to configure the site- a new database, a new domain).

Now, I have access to new themes, Editor, …, BUT when I change the default theme with another, even after reboot the NS, I can’t see the pictures from theme (same thing an for the first installation(s), I forgot to mention and this). If I revert to the initial theme, I can see all pictures from theme.

I will try following the same procedure to copy the WordPress to /var/www/html/ to see if works there.

“when I change the default theme with another, even after reboot the NS, I can’t see the pictures from theme … . If I revert to the initial theme, I can see all pictures from theme.”

Where can be the problem (of course not me :innocent:)?!?

I know that wordpress is really sensible from what it writes to its database, for example you cannot change the url once installed without altering the mysql database with the new url.

My guess is if you want two different wordpress installations, install two different wordpress without trying to copy the web files and mysql database

1 Like

Hi @stephdl ,

We have some sites based on WordPress installed on two servers.
One has CentOS 6.3 as OS, with one WP site and the other has Windows 2012R2 as OS with more than 4 WP sites.

All WP sites are “installed” in the same way and work without issues.
I wrote “installed” because, in fact, each WP site is a copy of the original directory where the archive was unpacked, and then linked to the corresponding database through wp-config.php.

Each WP site has own domain/url.
Before the final version of each site, during negotiation with the customer, we change the theme often, on the same database, without problems.

Bref (in Romania, we, “the oldies”, use often this expression). To have two different WP installation, we copy twice the “original WP” in two different locations (virtual hosts), linked to two different mysql databases. After that, we develop each site till the final version, without changing the URL.

Today, on all my WP installations, I have tried to use virtual hosts and change only the default theme. As I show, I failed.
Maybe is from the updates to CentOS 7.4. Maybe it’s my fault … I will try to install again NS 7.3 and set WP sites with virtual hosts, without updates.

Another try will be to install from scratch CentOS 7.3 basic (without NS), and then follow one of the mentioned procedure from above to see if it works.

Because we have more and more requests for WP sites, I want to use NS for hosting.
So, I want to be sure that everything goes well with NS, to give to my colleagues from software dept. a good HW/SW platform.

Thank you for your reply!

Kind regards,
Gabriel

I tried it now and it seems to work. I can change themes, add header image and it is shown in any theme…I hope I understood you right.
What I did:

  • Cleaned system by removing all wordpress related packages and erased wordpress db
  • Installed nethserver-wordpress
  • Setup vhost

  • Copied /usr/share/wordpress to …vhost/wordpress2 directory. I did it with mc and selected “follow links” and “Dive into subdir…”.

  • Copied database with phpmyadmin and exported rights for wordpress user
  • Changed wp-config.php

define(‘DB_NAME’, ‘wordpress2’);
define(‘ABSPATH’, ‘/var/lib/nethserver/vhost/wordpress2/’);

  • Browse to wordpress2.domain.local

System version: NethServer release 7.4.1708 (beta1)
Kernel release: 3.10.0-693.2.2.el7.x86_64

2 different themes with header pics:


2 Likes

Great!

I will try tomorrow if I will have time, following your procedure and I will report back.

Thank you again !

Kind regards,
Gabriel

You’re welcome.

I’m already curious… :smile:

2 Likes

If all works, a script may be nice like:

which

  • copies a webapp from a template dir to the specified vhost, which may be automatically created
  • clones database from a template db(or just creates empty one) and gives it specified name and rights
  • makes config file changes

So we may provide webapps in a smooth way…just an idea.

1 Like

The usually way, for a new WP site, is:

  • copies a webapp from a template dir to the specified vhost
  • creates an empty database and gives it specified name and rights
  • makes config file changes (wp-config.php)

Will be nice to be a script!

I had read that Nethserver 7.5 no longer uses the templating system httpd so i manually installed wordpress in the /var/www/html folder ran the command chown -R apache:apache /var/www/html/ then created sql database manually for wordpress, set my wordpreess site up through https://www.mydomain.com/wp-admin logged into wordpress ran the updates started adding pages I can access my site fine doing https://www.mydomain.com however if I go to any of the pages http://www.mydomain.com/about I get the below anyway to fix this

The requested URL /about/ was not found on this server.

Could you check your permalinks in WordPress and also check that .htaccess is writable. If that doesn’t work change the AllowOveride None to AllowOveride All and see if that works. Hope this helps.

Where did you read that?

Don’t remember where but its true, httpd.conf is a static file

Hi stevieb413,

I am on 7.6.810 and have the same problem. If the permalink is set to something else than simple I receive the message “The requested URL … was not found on this server”.

If I set to “Nom de l’article” (Name of the article) it will create the .htaccess file and I cannot access nothing - it looks like the WordPress disappeared.

If I erase the content of .htaccess, WordPress is back.

Also in wp-config.php I have to add:

if(is_admin()){
add_filter(‘filesystem_method’, create_function(’$a’, ‘return “direct”;’ ));
define( ‘FS_CHMOD_DIR’, 0751 );
}

If I don’t, WordPress cannot find the path.

It’s been 2 days that I am on WordPress.

Last month, with Duplicator extension, I migrated my main web site (WooCommerce) to a NethServer virtual host and it is working but I didn’t try everything. I run it in VirtualBox to test it.

Michel-André

Can you try to add a .httaccess and give it the rights 777 .
Set the permalinks to “Postname” and try again to see what it will do.
If it works, then give it the rights 444 and see if it still works.

I did that after installing the Stephdl WordPress and it works.
I have: https://www.toto.org/wordpress/**bonjour-tout-le-monde**/

I will try to install a standard WordPress in /var/www/html and see what it will do.
I will let you know…

Michel-André

I think I found the show stopper.

It is /etc/httpd/conf/httpd.conf at line 151: AllowOverride None inside <Directory “/var/www/html”>
If I change it for: AllowOverride ALL then everything is working fine.

If it is at None, it will not process any .httaccess it finds; it skips all of them.

Wordpress is looking for the page with the suffix Potsname but it cannot find it because without httpd reading the .httaccess WordPress think the permalinks is set to Postname which is not, it is set to Plain and he cannot find the page and display an error of “Page not found”. Correct me if I’m wrong.

There should be a way to modify the httpd.conf with a custom template.

At least now I know where to look or maybe somebody knows how to do that…

Michel-André

PS:
Re-reading all the posts I see that I am writing the same thing as makshaz wrote 19d ago.

PPS:
Fragment /etc/e-smith/templates/httpd/vhost-extra/30directory20allowoverride has the directive: AllowOverride All That is why it is working with Vhost but not with /var/www/html

So if StephDL say that “httpd.conf is a static file” then I just have to edit /etc/httpd/conf/httpd.conf and the problem will be solved?

The only problem left is why do I have to add those extra lines at the end of wp-config.php so that WordPress will find the path?

if(is_admin()){ add_filter(‘filesystem_method’, create_function(’$a’, ‘return “direct”;’ )); define( ‘FS_CHMOD_DIR’, 0751 );}

Any comment is appreciated,

could I suggest to use either a virtualhost from the module, or to create your own virtualhost by adding a configuration in /etc/httpd/conf.d/myWordpress.conf

Like this you will have your free hand, /var/www/html is likely to drop a web application just for testing it…IMHO

Version: 7.6
# yum install --enablerepo=nethforge nethserver-wordpress
No package Nethserver-WordPress available.
Error: Nothing to do

Please, follow up to date instructions from:
https://wiki.nethserver.org/doku.php?id=wordpress