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.
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
Related
I'm using Laragon on Windows 10, and I want to create a subdomain for a new project,
The current structure is:
https://management.test
https://management.test/includes
https://management.test/client
I want to access the client folder using this URL:
https://client.management.test
But I don't want to have https://includes.management.test
I want the configuration to be only on the client folder.
I've tried playing with the Apache sites-enabled file but didn't get the result,
Can anyone share a working example with me or a simple solution to achieve this?
Thank you.
I just figured this out.
This "manual" solution worked for me
I edited drivers\etc\hosts and added my subdomain like
127.0.0.1 sub.project.test
Enable mod_vhost_alias.so in laragon\bin\apache[version]\conf\httpd.conf
Create a new file like {laragon folder}\etc\apache2\sites-enabled\sub.project.test.conf"
Add the following code in the file you just created
define ROOT "C:/laragon/htdocs/project/sub/"
define SITE "sub.project.test"
<VirtualHost *:80>
DocumentRoot ${ROOT}
ServerName ${SITE}
ServerAlias *.${SITE}
<Directory "${ROOT}">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:443>
DocumentRoot "${ROOT}"
ServerName ${SITE}
ServerAlias *.${SITE}
<Directory "${ROOT}">
AllowOverride All
Require all granted
</Directory>
SSLEngine on
SSLCertificateFile C:/laragon/etc/ssl/laragon.crt
SSLCertificateKeyFile C:/laragon/etc/ssl/laragon.key
</VirtualHost>
Replace ROOT to the path to the subdomain folder
Finally reload apache and visit the subdomain
References :
https://forum.laragon.org/topic/1705/help-subdomain-laragon/3
https://github.com/leokhoa/laragon/issues/90
I'm trying to mount an AWS server with 2 different projects. The specification of the AMI is this
Platform: Amazon Linux (inferred)
Details of platform: Linux/UNIX
All the AMI configuration is done, the 80 port is avaible. The IP is this http://13.59.121.162/
I'm using apache to serve the files.
I tried to find the folder /etc/apache2/sites-available but this distribution has not that directory. I have not idea how to create it manually and the inside files. I found this file
/etc/httpd/conf/httpd.conf
And I edited and added a new VirtualHost lines
<VirtualHost *:80>
ServerAdmin foo#bar.com
DocumentRoot /var/www/html/food
ServerName 13.59.121.162/food
ErrorLog logs/food-error_log
CustomLog logs/food-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin foo#bar.com
DocumentRoot /var/www/html/backoffice
ServerName 13.59.121.162/admin
ErrorLog logs/admin-food-error_log
CustomLog logs/admin-food-access_log common
</VirtualHost>
The apache's directory structure is this
/var
/www
/html
/backoffice
-index.html <-- <h1>Aquí backoffice</h1>
/food
-index.html <-- <h1>Aquí la comida</h1>
I visited http://13.59.121.162/food but I have an error (ERR_CONNECTION_TIMED_OUT) Can't access to this website. I hope to see Aquí la comida, but nothing. I have the same error with the other configuration, but if I visit http://13.59.121.162 it shows Aquí la comida
What did I do wrong?
nowhere in your configuration have you granted access, you need to grant access to the directories,, something like this...
<VirtualHost *:80>
<Directory /var/www/html/food>
Require All Granted
</Directory>
</VirtualHost>
in my httpd-vhost.conf on macos 10.15.4,
<VirtualHost *:80>
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/theb/"
ServerName theb.localhost
ServerAlias www.theb.localhost
#DirectoryIndex index.html
<Directory "/Applications/XAMPP/xamppfiles/htdocs/theb">
Require all granted
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride none
</Directory>
ErrorLog "logs/theb.local-error_log"
</VirtualHost>
I have also included the virtual host in httpd.conf
Include etc/extra/httpd-vhosts.conf
Then in the host file, i have
127.0.0.1 localhost
127.0.0.1 www.theb.localhost
The issue im facing now with these configs is that whenever i browse the site in my browser,
http://www.theb.localhost, i will then be redirected to http://www.theb.localhost/dashboard ( which is the xampp default project folder). did i miss something out??
Restart Apache. Hopefully that will work.
If you have downloaded the VM version of Xampp (The one that gets mounted) then this wont work as it doesn't have access to your local files, get the non VM one here https://sourceforge.net/projects/xampp/files/XAMPP%20Mac%20OS%20X/7.4.6/xampp-osx-7.4.6-0-installer.dmg/download
I have a domain on 1and1 with dns setup to point to a Amazon EC2 Linux instance..
I also have a subdomain with the same dns settings: pma.mydomain.com
I need to setup that subdomain to point to /usr/share/phpMyAdmin instead of /var/www/html (Document root of Apache)
I tried to create a VirtualHost inside httpd.conf with the following:
<VirtualHost *:80>
ServerAdmin webmaster#mydomain.com
DocumentRoot /usr/share/phpMyAdmin
ServerName pma.mydomain.com
ErrorLog logs/pma.mydomain.com-error-log
CustomLog logs/pma.mydomain.com-custom-log common
<Directory "/usr/share/phpMyAdmin/">
Allow From All
Options +Indexes
</Directory>
</VirtualHost>
The problem is that I see the content of /usr/share/phpMyAdmin also by visiting www.mydomain.com.
I think I'm missing something, it is the first time I try to setup a Virtual Host.
I've been following this guide as much as I could
http://robsnotebook.com/xampp-ssl-encrypt-passwords .
However whenever I browse to a page starting with https the apache server replies 404 Object Not Found.
What setting I am missing? Thanks for any help.
Found the answer. In the file xampp\apache\conf\extra\httpd-ssl.conf, under the comment SSL Virtual Host Context pages on port 443 meaning https is looked up under different document root.
Simply change the document root to the same one and problem is fixed.
You can also configure your SSL in xampp/apache/conf/extra/httpd-vhost.conf like this:
<VirtualHost *:443>
DocumentRoot C:/xampp/htdocs/yourProject
ServerName yourProject.whatever
SSLEngine on
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"
</VirtualHost>
I guess, it's better not change it in the httpd-ssl.conf if you have more than one project and you need SSL on more than one of them
For XAMPP, do the following steps:
G:\xampp\apache\conf\extra\httpd-ssl.conf"
Search 'DocumentRoot' text.
Change DocumentRoot DocumentRoot "G:/xampp/htdocs" to DocumentRoot "G:/xampp/htdocs/project name".
configure SSL in xampp/apache/conf/extra/httpd-vhost.conf
http
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/myproject/web"
ServerName www.myurl.com
<Directory "C:/xampp/htdocs/myproject/web">
Options All
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
https
<VirtualHost *:443>
DocumentRoot "C:/xampp/htdocs/myproject/web"
ServerName www.myurl.com
SSLEngine on
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"
<Directory "C:/xampp/htdocs/myproject/web">
Options All
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
make sure server.crt & server.key path given properly otherwise this will not work.
don't forget to enable vhost in httpd.conf
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
There is a better guide here for Windows:
https://shellcreeper.com/how-to-create-valid-ssl-in-localhost-for-xampp/
Basic steps:
Create an SSL certificate for your local domain using this: See more details in the link above
https://gist.github.com/turtlepod/3b8d8d0eef29de019951aa9d9dcba546
https://gist.github.com/turtlepod/e94928cddbfc46cfbaf8c3e5856577d0
Install this cert in Windows (Trusted Root Certification Authorities) See more details in the link above
Add the site in Windows hosts (C:\Windows\System32\drivers\etc\hosts)
E.g.: 127.0.0.1 site.test
Add the site in XAMPP conf (C:\xampp\apache\conf\extra\httpd-vhosts.conf)
E.g.:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName site.test
ServerAlias *.site.test
</VirtualHost>
<VirtualHost *:443>
DocumentRoot "C:/xampp/htdocs"
ServerName site.test
ServerAlias *.site.test
SSLEngine on
SSLCertificateFile "crt/site.test/server.crt"
SSLCertificateKeyFile "crt/site.test/server.key"
</VirtualHost>
Restart Apache and your browser and it's done!
I finally got this to work on my own hosted xampp windows 10 server web site. I.e. padlocks came up as ssl. I am using xampp version from November 2020.
Went to certbot.eff.org. Selected from their home page software [apache] and system [windows]. Then downloaded and installed certbot software found at the next page into my C drive.
Then from command line [cmd in Windows Start and then before you open cmd right click to run cmd as admin] I enhtered the command from Certbot page above. I.e. navigated to system32-- C:\WINDOWS\system32> certbot certonly --standalone
Then followed the prompts and enteredmy domain name. This created certs as cert1.pem and key1.pem in C:\Certbot yourwebsitedomain folder. the cmd windows tells you where these are.
Then took these and changed their names from cert1.pem to my domainname or shorter+cert.pem and same for domainname or shorter+key.key. Copied these into C:\xampp\apache\ssl.crt and ssl.key folders respectively.
Then for G:\xampp\apache\conf\extra\httpd-vhosts entered the following:
<VirtualHost *:443>
DocumentRoot "G:/xampp/htdocs/yourwebsitedomainname.hopto.org/public/" ###NB My document root is public. Yours may not be. Or could have an index.php page before /public###
ServerName yourwebsitedomainnamee.hopto.org
<Directory G:/xampp/htdocs/yourwebsitedomainname.hopto.org>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
ErrorLog "G:/xampp/apache/logs/error.log"
CustomLog "G:/xampp/apache/logs/access.log" common
SSLEngine on
SSLCertificateFile "G:\xampp\apache\conf\ssl.crt\abscert.pem"
SSLCertificateKeyFile "G:\xampp\apache\conf\ssl.key\abskey.pem"
</VirtualHost>
Then navigated to G:\xampp\apache\conf\extra\httpd-ssl.conf and did as was advised above. I missed this important step for days until I read this post. Thank you!
I.e. entered
<VirtualHost _default_:443>
DocumentRoot "G:/xampp/htdocs/yourwebsitedomainnamee.hopto.org/public/"
###NB My document root is public. Yours may not be. Or could have an index.php page before /public###
SSLEngine on
SSLCertificateFile "conf/ssl.crt/abscert.pem"
SSLCertificateKeyFile "conf/ssl.key/abskey.pem"
CustomLog "G:/xampp/apache/logs/ssl_request.log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>
Note1. I used www.noip.com to register the domain name.
Note2. Rather then try to get them to give me a ssl certificate, as I could not get it to work, the above worked instead.
Note3 I use the noip DUC software to keep my personally hosted web site in sync with noip.
Note4. Very important to stop and start xampp server after each change you make in xampp. If xampp fails for some reason instead of starting the xampp consol try the start xampp as this will give you problems you can bug fix. Copy these quickly and paste into note.txt.
In case you are on Mac OS (catalina or mojave) and wants to enable HTTPS/SSL on XAMPP for Mac, you need to enable the virtual host and use the default certificates included in XAMPP.
On your httpd-vhosts.conf file add a new vhost:
<VirtualHost *:443>
ServerAdmin webmaster#localhost.com
DocumentRoot "/Users/your-user/your-site"
ServerName your-site.local
SSLEngine on
SSLCertificateFile "etc/ssl.crt/server.crt"
SSLCertificateKeyFile "etc/ssl.key/server.key"
<Directory "/Users/your-user/your-site">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
Order allow,deny
Allow from all
</Directory>
</VirtualHost>