v.02
Move the existing friendica installation to a new directory folder in /var/www/
:
new directory
Create directory.
Create a copy of the working installation from /var/www/html/ in the new /var/www/domainorg/ directory.
Check ownership of /domainorg/ itself and of the folders in /domainorg/.
As the folders where copied as user root the ownership of www-data for the instalation has to be established again.
Set the ownership of the folder /var/www/domainorg/ itself to root.rootname@VPShosting:~# mkdir /var/www/domainorg/
rootname@VPShosting:~# cp -R /var/www/html/ /var/www/domainorg/
rootname@VPShosting:~# ls -l /var/www/
rootname@VPShosting:~# ls -l /var/www/domainorg/
rootname@VPShosting:~# chown -R www-data:www-data /var/www/domainorg/
rootname@VPShosting:~# chown root:root /var/www/domainorg/
Create a standard http and https domain registry file on the
... mehr anzeigenv.02
Move the existing friendica installation to a new directory folder in /var/www/
:
new directory
Create directory.
Create a copy of the working installation from /var/www/html/ in the new /var/www/domainorg/ directory.
Check ownership of /domainorg/ itself and of the folders in /domainorg/.
As the folders where copied as user root the ownership of www-data for the instalation has to be established again.
Set the ownership of the folder /var/www/domainorg/ itself to root.rootname@VPShosting:~# mkdir /var/www/domainorg/
rootname@VPShosting:~# cp -R /var/www/html/ /var/www/domainorg/
rootname@VPShosting:~# ls -l /var/www/
rootname@VPShosting:~# ls -l /var/www/domainorg/
rootname@VPShosting:~# chown -R www-data:www-data /var/www/domainorg/
rootname@VPShosting:~# chown root:root /var/www/domainorg/
Create a standard http and https domain registry file on the VPS server in:
/etc/apache2/sites-available/
The original settings of the server are defined in the folder /etc/apache2/sites-available/ by the files 000-default.conf and for the SSL settings in 000-default-le-ssl.conf.
original 000-default file settings
original 000-default.conf file settings
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =domain.org
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
original 000-default-le-ssl.conf file settings
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory /var/www/html>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName domain.org
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/domain.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.org/privkey.pem
</VirtualHost>
</IfModule>
create domain.org.conf
This is actually a by default step as we are going to setup the SSL HTTPS setting as standard and mandatory.
Create and open the .conf file with the nano text editor.
Create the following content in that domain.org.conf file and safe it. This content is taken from the original 000-default.conf file. The only change is actually the DocumentRoot entry.rootname@VPShosting:~# nano /etc/apache2/sites-available/domain.org.conf
domain.org.conf content to be inserted
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/doamainorg
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =domain.org
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
STRG
+
X
|
SHIFT
+
Y
|
ENTER
create domain.org-le-ssl.conf
Create and open the .conf file with the nano text editor.
Create the following content in that domain.org-le-ssl file and safe it. This content is taken from the original 000-default-le-ssl.conf file. The only change is actually the DocumentRoot entry.rootname@VPShosting:~# nano /etc/apache2/sites-available/domain.org-le-ssl
domain.org-le-ssl content to be inserted
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/domainorg
<Directory /var/www/html>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName domain.org
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/domain.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.org/privkey.pem
</VirtualHost>
</IfModule>
STRG
+
X
|
SHIFT
+
Y
|
ENTER
Check domain IP redirect settings by the domain registry provider!
Those settings should be fine as they were set and working by the inicial setup.
activating and deactivating .conf files
To make the changes come into effect the new conf file have to be activated, the old ones that don't apply anymore should be deactivated and the apache server itself has to be reloaded or to be restarted:rootname@VPShosting:~# a2ensite domain.org
rootname@VPShosting:~# a2ensite domain.org-le-ssl.conf
rootname@VPShosting:~# a2dissite 000-default.conf
rootname@VPShosting:~# a2dissite 000-default-le-ssl.conf
rootname@VPShosting:~# systemctl restart apache2
Reloading the site should take a while longer than nomal, indicating that new inicial background tasks are happening.
test the new folder structure
Check if the new site configuration is actually in place.
Rename the index file of the old /html folder.
Reload the site. It should still work. If so, the old index.html isn't active anymore.
Rename the entire old /html folder structure taking it out of access completely.
Create a new /html folder.
Create a new html. index file in /var/www/html/rootname@VPShosting:~# mv /var/www/html/index.php /var/www/html/index_old.php
rootname@VPShosting:~# mv /var/www/html/ /var/www/html_old/
rootname@VPShosting:~# mkdir /var/www/html/
rootname@VPShosting:~# nano /var/www/html/index.html
content to be inserted into index.html
<html>
<title>name-based virtual hosting setup</title>
<h1>Welcome to the /html/ index.html fall back file.</h1>
<p>This is a test file for a name-based virtual hosting setup</p>
</html>
STRG
+
X
|
SHIFT
+
Y
|
ENTER