Search code examples
apacheamazon-web-servicesamazon-ec2virtualhostbitnami

Hosting another website on linux AMAZON EC2 intance running bitnami wordpress


I have an EC2 instance created with Bitnami wordpress, I am trying to host my other website on the same instance website.tld

I followed the steps on this guide https://docs.bitnami.com/aws/components/apache/#how-to-create-a-virtual-host

Then I went to "/opt/bitnami/apps/wordpress/conf/httpd-vhosts.conf" and changed it to

<VirtualHost *:80>
    ServerName mywordpress.com
    ServerAlias mywordpress.com
    DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"

    Include "/opt/bitnami/apps/wordpress/conf/httpd-app.conf"
</VirtualHost>

<VirtualHost *:80>
    ServerName website.tld
    ServerAlias www.website.tld
    DocumentRoot "/opt/bitnami/apps/website/htdocs"

    ErrorLog "logs/website-error_log"
    CustomLog "logs/website-access_log" common
</VirtualHost>

<VirtualHost *:443>
    ServerName mywordpress.com
    ServerAlias www.mywordpress.com
    DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"
    SSLEngine on
    SSLCertificateFile "/opt/bitnami/apps/wordpress/conf/certs/server.crt"
    SSLCertificateKeyFile "/opt/bitnami/apps/wordpress/conf/certs/server.key"

    Include "/opt/bitnami/apps/wordpress/conf/httpd-app.conf"
</VirtualHost>

I created the empty folders "/opt/bitnami/apps/website/htdocs" for my new website then added an index.html inside htdocs

Then I restarted the apache server

sudo /opt/bitnami/ctlscript.sh restart apache

mywordpress.com works fine as before, but when i try to open website.tld I get this error

Forbidden

You don't have permission to access / on this server.

Am i doing it wrong? is there any other configurations i missed?

What is more confusing is there are httpd-vhosts.conf files inside the apache2 server and inside each folder in the apps/ folder, I am not sure which of all I should be adding my new domain tag into? Following the bitnami docs I edited the one inside apps/wordrpess/config

I am not a server side guy, is there a UI for the apache server that can help me setup the virtual host?

Thank you in advance.


Solution

  • You have to set the permissions for this directory in apache2.conf/ httpd.conf.

    <Directory [your path]>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
    </Directory>
    

    And set the permissions with chmod 755