Configuring Apache for a new website in a Bitnami Lamp server.
Configuring apache in a bitnami server is a bit confusing at the begining but once you get the idea, it becomes so simple.
In recent versions of BitNami apps the bitnami.conf file defines which configuration for each application should be loaded by the Apache server. This file is located in/installdir/apache2/conf/bitnami/bitnami.conf. Note that for Virtual Machines and Cloud Images installdir is /opt/bitnami.
Here we are configuring for a Virtual Machines, thus the installdir is /opt/bitnami
basically the directory we use for putting the web contents is /home/bitnami/apps/
the website i going to add for example is bucolic.com . We need to follow the following steps then:-
1.) Create a folder named bucolic in the directory /home/bitnami/apps/ and give ownership as bitnami
2.) create 2 other directories conf and htdocs inside the directory bucolic
3.) Put all the web contents inside the directory htdocs including the index page just like the other servers.
4.)Inside the conf directory, create three files httpd-app.conf, httpd-prefix.conf and httpd-vhosts.conf.
5.)Here lies the game. We need to edit those files as shown below:-
httpd-app.conf
---------------------------------------------------------------------------------------------------------------------
<Directory "/opt/bitnami/apps/bucolic/htdocs">
Options +MultiViews
AllowOverride None
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>
----------------------------------------------------------------------------------------------------------------------
httpd-prefix.conf
--------------------------------------------------------------------------------------------------
Alias /bucolic/ "/opt/bitnami/apps/bucolic/htdocs/"
Alias /bucolic "/opt/bitnami/apps/bucolic/htdocs"
Include "/opt/bitnami/apps/bucolic/conf/httpd-app.conf"
--------------------------------------------------------------------------------------------------
httpd-vhosts.conf
---------------------------------------------------------------------------------------------------------------------
<VirtualHost *:80>
ServerName bucolic.com
ServerAlias www.bucolic.com
DocumentRoot "/opt/bitnami/apps/bucolic/htdocs"
Include "/opt/bitnami/apps/bucolic/conf/httpd-app.conf"
</VirtualHost>
<VirtualHost *:443>
ServerName bucolic.com
ServerAlias www.bucolic.com
DocumentRoot "/opt/bitnami/apps/bucolic/htdocs"
Include "/opt/bitnami/apps/bucolic/conf/httpd-app.conf"
SSLEngine on
SSLCertificateFile "/opt/bitnami/apps/bucolic/conf/certs/server.crt"
SSLCertificateKeyFile "/opt/bitnami/apps/bucolic/conf/certs/server.key"
Include "/opt/bitnami/apps/bucolic/conf/httpd-app.conf"
</VirtualHost>
--------------------------------------------------------------------------------------------------
Then save the file. If you have SSL certs, u can put them in the conf/certs/ directory as specified in the configuration.
After all this modification, we need to go to the main configuration file of Bitnami.
/opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf
Inside this file we need to update the following line :-
Include "/home/bitnami/apps/bucolic/conf/httpd-vhosts.conf"
Save the file and restart apache using the following command:-
sudo /opt/bitnami/ctlscript.sh restart
If everything is configured correct, u will see a message of this kind
---------------------------------------------------------------------------------------
Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : httpd stopped
/opt/bitnami/php/scripts/ctl.sh : php-fpm stopped
/opt/bitnami/mysql/scripts/ctl.sh : mysql stopped
140807 10:05:16 mysqld_safe Logging to '/opt/bitnami/mysql/data/mysqld.log'.
140807 10:05:16 mysqld_safe Starting mysqld.bin daemon with databases from /opt/bitnami/mysql/data
/opt/bitnami/mysql/scripts/ctl.sh : mysql started at port 3306
[07-Aug-2014 10:05:23] NOTICE: configuration file /opt/bitnami/php/etc/php-fpm.conf test is successful
/opt/bitnami/php/scripts/ctl.sh : php-fpm started
Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : httpd started at port 80
----------------------------------------------------------------------------------------
Enjoy your Website!!!
In recent versions of BitNami apps the bitnami.conf file defines which configuration for each application should be loaded by the Apache server. This file is located in/installdir/apache2/conf/bitnami/bitnami.conf. Note that for Virtual Machines and Cloud Images installdir is /opt/bitnami.
Here we are configuring for a Virtual Machines, thus the installdir is /opt/bitnami
basically the directory we use for putting the web contents is /home/bitnami/apps/
the website i going to add for example is bucolic.com . We need to follow the following steps then:-
1.) Create a folder named bucolic in the directory /home/bitnami/apps/ and give ownership as bitnami
2.) create 2 other directories conf and htdocs inside the directory bucolic
3.) Put all the web contents inside the directory htdocs including the index page just like the other servers.
4.)Inside the conf directory, create three files httpd-app.conf, httpd-prefix.conf and httpd-vhosts.conf.
5.)Here lies the game. We need to edit those files as shown below:-
httpd-app.conf
---------------------------------------------------------------------------------------------------------------------
<Directory "/opt/bitnami/apps/bucolic/htdocs">
Options +MultiViews
AllowOverride None
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>
----------------------------------------------------------------------------------------------------------------------
httpd-prefix.conf
--------------------------------------------------------------------------------------------------
Alias /bucolic/ "/opt/bitnami/apps/bucolic/htdocs/"
Alias /bucolic "/opt/bitnami/apps/bucolic/htdocs"
Include "/opt/bitnami/apps/bucolic/conf/httpd-app.conf"
--------------------------------------------------------------------------------------------------
httpd-vhosts.conf
---------------------------------------------------------------------------------------------------------------------
<VirtualHost *:80>
ServerName bucolic.com
ServerAlias www.bucolic.com
DocumentRoot "/opt/bitnami/apps/bucolic/htdocs"
Include "/opt/bitnami/apps/bucolic/conf/httpd-app.conf"
</VirtualHost>
<VirtualHost *:443>
ServerName bucolic.com
ServerAlias www.bucolic.com
DocumentRoot "/opt/bitnami/apps/bucolic/htdocs"
Include "/opt/bitnami/apps/bucolic/conf/httpd-app.conf"
SSLEngine on
SSLCertificateFile "/opt/bitnami/apps/bucolic/conf/certs/server.crt"
SSLCertificateKeyFile "/opt/bitnami/apps/bucolic/conf/certs/server.key"
Include "/opt/bitnami/apps/bucolic/conf/httpd-app.conf"
</VirtualHost>
--------------------------------------------------------------------------------------------------
Then save the file. If you have SSL certs, u can put them in the conf/certs/ directory as specified in the configuration.
After all this modification, we need to go to the main configuration file of Bitnami.
/opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf
Inside this file we need to update the following line :-
Include "/home/bitnami/apps/bucolic/conf/httpd-vhosts.conf"
Save the file and restart apache using the following command:-
sudo /opt/bitnami/ctlscript.sh restart
If everything is configured correct, u will see a message of this kind
---------------------------------------------------------------------------------------
Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : httpd stopped
/opt/bitnami/php/scripts/ctl.sh : php-fpm stopped
/opt/bitnami/mysql/scripts/ctl.sh : mysql stopped
140807 10:05:16 mysqld_safe Logging to '/opt/bitnami/mysql/data/mysqld.log'.
140807 10:05:16 mysqld_safe Starting mysqld.bin daemon with databases from /opt/bitnami/mysql/data
/opt/bitnami/mysql/scripts/ctl.sh : mysql started at port 3306
[07-Aug-2014 10:05:23] NOTICE: configuration file /opt/bitnami/php/etc/php-fpm.conf test is successful
/opt/bitnami/php/scripts/ctl.sh : php-fpm started
Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : httpd started at port 80
----------------------------------------------------------------------------------------
Enjoy your Website!!!
Super!
ReplyDeleteyour guide solve my local developer environment as a charm!
Thanks :)
Happy to help you :)
Delete