Hosted two websites on same bitnami server

Hi @jota … as for the above documents , I din’t want to use the all in one migration plugin …
I already have the wordpress folders and want to put them in the correct path!

Till now I don’t have a clear steps for that … your documents are not clear and stuck with one solution…

I need a clear steps how to implement three websites and access them from internet using their domain name, could you please provide a clear steps without referring back to your documentations as they are written for general case?

Hi @ghina.altal,

I think we are messing this thread with different topics. Please, first answer the questions below so we can get a better understanding of your problem.

  • Did you installed the Bitnami WordPress modules that @jota mentioned in his previous post?
  • Have you already modified anything in your server? If so, what?

Also, in one of his previous post, @jota mentioned about using WordPress Multisite for hosting multiple WordPress sites using different domain names for each site in the same server. Another option is manually installing multiple Bitnami WordPress modules.

Please let us know which option do you want to follow. In my opinion, the easier one is using WordPress Multisite.

Regards,
Gonzalo

I have bitnami-LAMP server. in the root directory of the server ( htdocs) , I create three sub directories as follows:

image
each directory contains the website files as:

image

I can access them in browser by typing server IP/ directory name, for example localhost/ww1.testatc.co.ae
and it works.

now I need to implement mapping for these hosted domains.
I want to access these websites from internet using their domain names … how can I implement that??

regarding the server…no I didn’t change any thing …

can you help me in that scenario … I already did this and don’t want to go with the other scenarios mentioned in ur documentation as I already put the files in the following paths.

Thank you.

Hi @ghina.altal,

We suggest you follow the way to configure the sites as I mentioned above because you will follow the Bitnami standards. In case you don’t want to follow our suggestions, you can follow these steps:

  • In the /opt/bitnami/apache2/conf/bitnami/bitnami.conf file, you can find the default VirtualHosts blocks of Apache. You can edit that file and include new VirtualHosts blocks per directory and per Apache’s port (80 and 443 port).

  • Inside the default VirtualHosts, we include the configuration of other files, you will need to remove that “Include” line and include the information you want to use in your WordPress.

This is an example

<VirtualHost *:80>
    ServerName ww1.testatc.co.ae
    DocumentRoot "/opt/bitnami/apache2/htdocs/ww1.testatc.co.ae"

<Directory "/opt/bitnami/apache2/htdocs/ww1.testatc.co.ae">
    Options +MultiViews +FollowSymLinks
    AllowOverride All
    <IfVersion < 2.3 >
        Order allow,deny
        Allow from all
    </IfVersion>
    <IfVersion >= 2.3>
        Require all granted
    </IfVersion>

    RewriteEngine On
    #RewriteBase /wordpress/
    RewriteRule ^index\.php$ - [S=1]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . index.php [L]
</Directory>

</VirtualHost>

This code should work to configure the virtual host for the first app. You will need to create another one for the 443 port. As I mentioned above, this doesn’t follow the Bitnami standards. You will need to deal with the configuration and ask us any questions you have when configuring it.

Hi @jota

Ok I want to follow Bitnami standers , can you give clear steps for that…

in Which path sould I put the folders and how to configure V host for them ???

Ok @ghina.altal,

Let’s start with the installation of the WordPress modules

cd /tmp
wget https://downloads.bitnami.com/files/stacks/wordpress/5.0.3-2/bitnami-wordpress-5.0.3-2-module-linux-x64-installer.run
chmod +x bitnami-wordpress-5.0.3-2-module-linux-x64-installer.run
sudo ./bitnami-wordpress-5.0.3-2-module-linux-x64-installer.run --wordpress_instance_name testatc
sudo ./bitnami-wordpress-5.0.3-2-module-linux-x64-installer.run --wordpress_instance_name testdo
sudo ./bitnami-wordpress-5.0.3-2-module-linux-x64-installer.run --wordpress_instance_name yasholding

After that, check that you can access those applications using yourIP/testatc, yourIP/testdo adn yourIP/yasholding. Those applications are empty so you will need to move the content of the current installations you have in htdocs to those folders

sudo mv /opt/bitnami/apps/testatc/htdocs /opt/bitnami/apps/testatc/htdocs.back
sudo mv /opt/bitnami/apps/testdo/htdocs /opt/bitnami/apps/testdo/htdocs.back
sudo mv /opt/bitnami/apps/yasholding/htdocs /opt/bitnami/apps/yasholding/htdocs.back
sudo cp -rp /opt/bitnami/apache2/htdocs/ww1.testatc.co.ae /opt/bitnami/apps/testatc/htdocs
sudo cp -rp /opt/bitnami/apache2/htdocs/ww1.testdo.ae /opt/bitnami/apps/testdo/htdocs
sudo cp -rp /opt/bitnami/apache2/htdocs/ww1.yasholding.ae /opt/bitnami/apps/yasholding/htdocs

Ensure now that you can access all the information you had in your previous installations using the /testatc, /testdo and /yasholding. You could remove the apache2/htdocs folder once you confirm that everything works as expected.

Finally, in order to configure the VirtualHosts https://docs.bitnami.com/aws/infrastructure/lamp/configuration/configure-custom-application/:

  • You will need to set the ServerNames and ServerAlias parameters in the /opt/bitnami/apps/testatc/conf/httpd-vhosts.conf. You will need to do the same with the other folders.
  • Remove the httpd-prefix.conf lines from the /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf
  • Include those files in the /opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf
Include "/opt/bitnami/apps/testatc/conf/httpd-vhosts.conf"
Include "/opt/bitnami/apps/testdo/conf/httpd-vhosts.conf"
Include "/opt/bitnami/apps/yasholding/conf/httpd-vhosts.conf"
  • Generate the certificate files
sudo ln -sf /opt/bitnami/apache2/conf/server.crt /opt/bitnami/apps/testatc/conf/certs/server.crt
sudo ln -sf /opt/bitnami/apache2/conf/server.key /opt/bitnami/apps/testatc/conf/certs/server.crt
sudo ln -sf /opt/bitnami/apache2/conf/server.crt /opt/bitnami/apps/testdo/conf/certs/server.crt
sudo ln -sf /opt/bitnami/apache2/conf/server.key /opt/bitnami/apps/testdo/conf/certs/server.crt
sudo ln -sf /opt/bitnami/apache2/conf/server.crt /opt/bitnami/apps/yasholding/conf/certs/server.crt
sudo ln -sf /opt/bitnami/apache2/conf/server.key /opt/bitnami/apps/yasholding/conf/certs/server.crt
  • Restart Apache
sudo /opt/bitnami/ctlscript.sh restart apache

Let us know if you have any questions or if something doesn’t work as expected

Hi @jota
I go with your documentation:
https://docs.bitnami.com/aws/infrastructure/lamp/administration/create-custom-application-php/

and moved the demo folder and do the steps … and I can access the demo folder using IP/demo as

in the httpd-vhosts.conf file for the demo application I set the following text:

image

I then tried to type ww1.testatc.co in the browser to test it, but I got this

how can I test if the hosting is okay?? and why the url is not opened the defult page??

here is a bitnami support tool code if you want to check it:
3733eec2-2d8f-1ac4-1c43-77b542e10990

Hi @ghina.altal,

You need to configure the domain name to point to the instance’s IP. As you can see in this online tool, the domain name is not configured yet

https://www.whatsmydns.net/#A/www1.testatc.co.ae

If you proceed with the manual approach, don’t know if you find any issue when following the steps I mentioned, you will need to start with moving the folders of your applications to the htdocs folders (apps/testatc/htdocs for example)

Hi @jota , yes the domain name still not register … I want to check if it correct first …

did you checked what I did? is it correct?

Also is there a way ( local way for mapping the domine name o instance IP address and check it locally) ??

Like using /etc/hosts file or smothing like that.

@jota I tried to put the files of one website in following path: /opt/bitnami/apps/testatc

eventhough bitnami user is the owner of the folders:

but I got this message from the browser:

@jota here is the code 5ebf98d6-4fb3-908c-7ada-46b8ead0f682

please I want to fixe this ASAP!

I followed the document by copy the demo folder

Hi @ghina.altal,

I just found this in the error_log file of Apache (/opt/bitnami/apache2/logs/error_log)

[Sun Feb 17 11:23:21.850764 2019] [rewrite:error] [pid 21683:tid 140141418997504] [client 188.247.64.179:64980] AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : /opt/bitnami/apps/testatc/htdocs/

You will need to add those options to the “Options” parameter in the /opt/bitnami/apps/testatc/conf/httpd-app.conf file.

Options Indexes MultiViews FollowSymLinks SymLinksIfOwnerMatch

and restart Apache.

sudo /opt/bitnami/ctlscript.sh restart apache

If you run into any other issue, please check the error_log file of Apache to ensure that the application is properly configured

@jota … thanx you … it is open,
now how can I access it with the domain name from the browser ???
I want to access it trying for example ww1.testatc.ae …

here are the configuration files content:

httpd.app.conf:

I can’t see the domain name on theses files … which file to edit, and what to amend??
also what permission and owner should be given to this web directory???

Hi @ghina.altal,

In order to access that WordPress installation using the domain name you want, you will need to follow these steps:

  • Add the domain you want to use to the httpd-vhosts.conf file of your testatc application.
  • Ensure that that file is included in the /opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf file. If not add it
Include "/opt/bitnami/apps/testatc/conf/httpd-vhosts.conf

https://docs.bitnami.com/aws/infrastructure/lamp/administration/understand-config/

  • Restart Apache
sudo /opt/bitnami/ctlscript.sh restart apache

If you didn’t configure your DNS provider with that domain name, you will need to modify the /etc/hosts file of your local computer to resolve the testatc.com domain with the IP of your instance.

@jota thank toy so much this reply was helpfull and clear…
just one thing please … how to add the domin name in httpd.vhosts.conf for testatc application??
here is the file … what to add to it ?

Hi @ghina.altal,

You will need to set the ServerName or the ServerAlias parameters to the domain you want to use

<VirtualHost *:80>
ServerName testatc.com
ServerAlias ww1.testatc.com
...

You can find more information about these parameters in the official page of Apache

https://httpd.apache.org/docs/2.4/mod/core.html#servername
https://httpd.apache.org/docs/2.4/mod/core.html#serveralias

@jota … about the permission and group owner…

should I run these command on the console:

sudo chown -R bitnami:daemon /opt/bitnami/apps/testatc/htdocs
sudo chmod -R g+w /opt/bitnami/apps/testatc/htdocs
sudo chmod 644 /opt/bitnami/apps/testatc/htdocs/wp-config.php

and for the conf directory and files: is this permission and owner correct? only bitnami user should own them?

I added domain name to the httpd.vhosts as this:

and to test the domin name, I added it to /etc/hosts file as suggested:

but when I brows it, I got following msg:

from where should I braws it? from inside bitnami server? how can I access bitnami browser??

Hi @ghina.altal,

Please remove the ServerName demo.example.com line in the httpd-vhosts.conf file, you don’t need it. You will need to restart Apache after that.

sudo /opt/bitnami/ctlscript.sh restart apache

It’s important to mention that you need to modify the hosts file of your local machine, not the one of the remote machine. I think you are using Windows in your local machine so please edit the Windows’s file

https://support.rackspace.com/how-to/modify-your-hosts-file/

Once you edit your local file, try to access the application again

Thanks

@jota yeah it’s open, that you so much :slight_smile:
what about the other part of the question … the files permission and owners for the folders … is it correct??

and when I should use port 443?? and how to configure ssl ???