Reputation: 635
I currently have one domain set up on my LAMP server, and I want to add another one. I tried doing it myself but when I ran into issues, I follow this.
I had example.com set up and it was working fine, all traffic would redirect to its https and I want to continue that. I am now getting as an error message after trying to restart the apache2:
script '/var/www/html/test.ca/public_html/httptest.php' not found or unable to stat
I've searched my apache2.conf file for httptest.php
but nothing matched.
/etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerName example.com
Redirect permanent / https://example.com/
</VirtualHost>
<VirtualHost *:80>
ServerName test.ca
Redirect permanent / http://test.ca
</VirtualHost>
<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /etc/ssl/localcerts/example.com.crt
SSLCertificateKeyFile /etc/ssl/localcerts/example.com.key
SSLCACertificateFile /etc/ssl/localcerts/intermediate.crt
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html/example.com/public_html/
ErrorLog /var/www/html/example.com/logs/error.log
CustomLog /var/www/html/example.com/logs/access.log combined
<Directory /var/www/html/example.com/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName test.ca
ServerAlias www.test.ca
DocumentRoot /var/www/html/test.ca/public_html/
ErrorLog /var/www/html/test.ca/logs/error.log
CustomLog /var/www/html/test.ca/logs/access.log combined
<Directory /var/www/html/test.ca/>
Require all granted
</Directory>
</VirtualHost>
/etc/apache2/sites-available/example.com.conf
<VirtualHost *:80>
ServerName example.com
Redirect permanent / https://example.com/
</VirtualHost>
<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /etc/ssl/localcerts/example.com.crt
SSLCertificateKeyFile /etc/ssl/localcerts/example.com.key
SSLCACertificateFile /etc/ssl/localcerts/intermediate.crt
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html/example.com/public_html/
ErrorLog /var/www/html/example.com/logs/error.log
CustomLog /var/www/html/example.com/logs/access.log combined
<Directory /var/www/html/example.com/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
</VirtualHost>
/etc/apache2/sites-available/test.ca.conf
<VirtualHost *:80>
ServerName test.ca
Redirect permanent / http://test.ca
</VirtualHost>
<VirtualHost *:444>
ServerAdmin [email protected]
ServerName test.ca
ServerAlias www.test.ca
DocumentRoot /var/www/html/test.ca/public_html/
ErrorLog /var/www/html/test.ca/logs/error.log
CustomLog /var/www/html/test.ca/logs/access.log combined
<Directory /var/www/html/test.ca/>
Require all granted
</Directory>
</VirtualHost>
My /etc/hosts file says (It has my ip instead):
127.0.0.1 myservername
When I do a ls -l
in /var/www/html/ I get:
-rw-r--r-- 1 root root 11510 Dec 15 20:49 index.html
drwxr-xr-x 4 root root 4096 Jan 11 19:19 test.ca
drwxr-xr-x 4 root root 4096 Dec 15 21:00 example.com
then changed it to:
-rw-r--r-- 1 root root 11510 Dec 15 20:49 index.html
drwxr-xr-x 4 sys sys 4096 Jan 11 19:19 test.ca
drwxr-xr-x 4 sys sys 4096 Dec 15 21:00 example.com
I've ran the code below and it says its enabled for both:
sudo a2ensite example.com
sudo a2ensite test.ca
The error occurs on apache restart.
Upvotes: 3
Views: 10402
Reputation: 92874
Have you activated your virtual hosts? If not ...
Activate hosts with the built in apache shortcut:
sudo a2ensite example.com
sudo a2ensite test.ca
And restart Apache service:
sudo service apache2 restart
Also check permissions of your project folders
Upvotes: 1