Issue
I have an AWS Lightsail Bitnami LAMP instance hosting a single web site. I want to create a site for a second domain on the same server but haven't yet found success.
I copied and modified a httpd-vhosts.conf file and placed it in /opt/bitnami/apache2/conf. I added an include statement to the end of /opt/bitnami/apache2/conf/bitnami/bitnami.conf pointing to the new httpd-vhosts.conf file. When attempting to access either the new or old site the browser response is "Forbidden You don't have permission to access / on this server".
There are two code blocks in /opt/bitnami/apache2/conf/httpd-vhosts.conf. This is one of them. The second block is identical with "site1" changed to "site2".
<VirtualHost *:80>
ServerAdmin me@site1.com
DocumentRoot "/opt/bitnami/apache2/site1.com/htdocs"
<Directory />
Options -Indexes
AllowOverride All
</Directory>
<Directory /opt/bitnami/apache2/site1.com/htdocs>
Options -Indexes
AllowOverride All
Order allow,deny
allow from all
</Directory>
ServerName site1.com
ServerAlias www.site1.com
ErrorLog "logs/site1.com-error_log"
CustomLog "logs/site1.com-access_log" common
</VirtualHost>
It appears that the new httpd-vhosts.conf file is being read because the new error and access logs are created. The error log states "client denied by server configuration:". The directory associated with this error in the error log is ...site1.com/htdocs as defined in the httpd-vhosts.conf file.
Solution
Bitnami Engineer here.
Let's try these changes to fix the errors you are running into:
- Remove the following block
<Directory />
Options -Indexes
AllowOverride All
</Directory>
You only need the one that sets the configuration for the folder where you have your app's files.
- You will need to substitute these lines because they are not supported in the new Apache's version
Order allow,deny
allow from all
is deprecated. You need to use Require all granted
when using Apache 2.4
https://httpd.apache.org/docs/2.4/mod/mod_authz_core.html#require
- Set the permissions of your app's folder properly
sudo chown -R bitnami:daemon /opt/bitnami/apache2/site1.com/htdocs
sudo chmod -R g+w /opt/bitnami/apache2/site1.com/htdocs
Answered By - Jota Martos Answer Checked By - Marie Seifert (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.