phplaravelamazon-web-servicesapachelamp

How to change AWS Lamp apache root directory?


I am using AWS Lamp apache service. Here htdocs folder is the default root directory. I have a folder named my-folder inside htdocs.

htdocs
  my-folder

I want to set my-folder as a root directory.

But How?

I have edited /opt/bitnami/apache/conf/httpd.conf Here are the edited codes in httpd.conf file.

# DocumentRoot "/opt/bitnami/apache/htdocs"
# <Directory "/opt/bitnami/apache/htdocs">

DocumentRoot "/opt/bitnami/apache/htdocs/my-folder"
<Directory "/opt/bitnami/apache/htdocs/my-folder">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

But it doesn't work!

Please correct me.


Solution

  • Problem Solved

    I just modified /opt/bitnami/apache/conf/vhosts/00_status-vhost.conf as below.

      <VirtualHost 127.0.0.1:80 _default_:80>
        ServerAlias *
        DocumentRoot /opt/bitnami/apache/htdocs/my-folder
        <Directory "/opt/bitnami/apache/htdocs/my-folder">
          Options -Indexes +FollowSymLinks -MultiViews
          AllowOverride All
          Require all granted
        </Directory>
      </VirtualHost>
    
       #for https
      <VirtualHost 127.0.0.1:443 _default_:443>
        ServerAlias *
        DocumentRoot /opt/bitnami/apache/htdocs/my-folder
        SSLEngine on
        SSLCertificateFile "/opt/bitnami/apache2/conf/bitnami/certs/server.crt"
        SSLCertificateKeyFile "/opt/bitnami/apache2/conf/bitnami/certs/server.key"
       <Directory "/opt/bitnami/apache/htdocs/my-folder">
          Options -Indexes +FollowSymLinks -MultiViews
          AllowOverride All
          Require all granted
        </Directory>
      </VirtualHost>
    

    and it's working!

    Documention provided by AWS Create A Virtual Host For A Custom Application