PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, September 21, 2022

[FIXED] How do I configure a Bitnami Lightsail LAMP server to host a second web site?

 September 21, 2022     amazon-lightsail, apache, bitnami, virtualhost     No comments   

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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing