Install Wordpress after nextcloud
Posted
#324
(In Topic #66)
Standard member
Installing WP after compleeting your nextcloud tutorial from youtube.
Hi!I followed this tutorial -> https://www.youtube.com/watch?v=QXfsi0pwgYw (thank you NOTS for an amazing in dept tutorial)
After purchasing a domain-name, installing ubuntu on my desktop pc and watching
the tutorial I finally god my nextcloud server up and running.
Now, I also want to add a wordpress site as well, prefeably under www.mydomain.com (which is already used for my nextcloud server) and then change my nextcloud installation to go under www.nextcloud.mydomain.com.
I can setup a new database and install it, but I`m afraid it will mess with my apache configuration as well as the SSL certificate.
I am familiar with using the terminal, but I have very little knowledge about the apache config files.
My system is running ubuntu server 18.04 and I use putty -> SSH to connect to it.
Posted
NOTS Staff
vimsee said
Hi!
Now, I also want to add a wordpress site as well, prefeably under www.mydomain.com (which is already used for my nextcloud server) and then change my nextcloud installation to go under www.nextcloud.mydomain.com.
I can setup a new database and install it, but I`m afraid it will mess with my apache configuration as well as the SSL certificate.
From “Install Wordpress after nextcloud”, April 11th 2019, 6:34 AM
Hello there, thanks for stopping by! This is a fairly easy use case; the hardest part will be moving your Nextcloud server's URL.
First, you'll want to set up another A record in your DNS pointing to the same IP address. (I'd recommend just using nextcloud.mydomain.com, but if you want www.nextcloud.mydomain.com, you can try creating an A record of "www.nextcloud".)
You can separate out your subdomain traffic using Apache by setting up virtual hosts. These are the files located at /etc/apache2/sites-available (and symlinked to /etc/apache2/sites-enabled after you run the a2ensite command.)
If you're using the default vhost, you'll want to make a copy of /etc/apache2/sites-available/000-default.conf to a location like /etc/apache2/sites-available/nextcloud.conf, and uncomment the ServerName line. Set the ServerName to nextcloud.mydomain.com, and make sure the DocumentRoot points to the location where your Nextcloud files are.
After you save that file, you'll want to run "a2ensite nextcloud" if you called the file nextcloud.conf, and then run Certbot again to make Let's Encrypt set up TLS for that site. Next is the tricky part: if you go to nextcloud.mydomain.com, you'll probably see a Nextcloud error. You'll need to edit /var/www/html/config/config.php (or wherever your Nextcloud config.php is located) and change the domain from www.mydomain.com to nextcloud.mydomain.com. After doing that, Nextcloud should let you access itself from the new URL.
Finally, you'll want to create a new directory in /var/www, maybe /var/www/wordpress, and change the DocumentRoot in your old /etc/apache2/sites-available file to point to that directory. (Alternatively, you could create another new vhost file called "wordpress.conf", set the ServerName to www.mydomain.com, set your DocumentRoot in that file, and run "a2ensite wordpress" to enable the vhost.) If at any point you don't have HTTPS (or you don't have it set up correctly), just run Certbot again and try to get it to apply Let's Encrypt to your configuration.
Let me know if this helps & if you have any questions/issues!
Posted
Standard member
I followed your instructions.
I took all the nextcloud files in /var/www/html and rsync → /var/www/html/nextcloud (including the .htaccess and .use.ini files.
I then emptied the /var/www/html and made a folder called wordpress.
I now have 2 folers in /var/www/html:
nextcloud
wordpress
Made a new database in mariadb and downloaded wordpress.
I then completed the installation.
I copied the 000-default.conf → nextcloud.conf in the apache sites available direcotry to preserve the original nextcloud configuration. and changed the ServerName.
Then I edited the DocumentRoot in 000-default.conf to the wordpress folder. Since I`ve run certbot previosly I also had to do the same changes to 000-default-le-ssl.conf.
Regarding the nextcloud config.php I added nextcloud.mydomain.com to the:
'trusted_domains' =>
as well as:
'overwrite.cli.url' =>
Then I ran:
"a2ensite nextcloud"
"certbot –apache"
Now everything seems to work fine. Thanks again for your help.
Last edit: by vimsee
1 guest and 0 members have just viewed this.