My Needs are
1. Configure Multiple Domain on XAMPP server on production (Woocommerce Site)
2. Configure and enable ssl
Steps i followed
Edited httpd-vshost as
NameVirtualHost *:80
ServerAdmin mail#firstsite.in
DocumentRoot "C:/xampp/htdocs/firstsite"
Allow from all
ServerName firstsite.in
ServerAlias www.firstsite.in
ServerAdmin mail#secondsite.in
DocumentRoot "C:/xampp/htdocs/secondsite"
ServerName secindsite.in
ServerAlias www.secondsite.in
Allow from all
Edited httpd-ssl
<VirtualHost _default_:443>
ServerAdmin admin#localhost
DocumentRoot "C:/xampp/htdocs/firstsite"
ServerName firstsite.in:443
ServerAlias www.firstsite.in:443
ErrorLog "logs/example-error.log"
CustomLog "logs/example-access.log" common
SSLEngine on
SSLCACertificateFile "C:\xampp\apache\conf\mibstore\ca_bundle.crt"
SSLCertificateFile "C:\xampp\apache\conf\mibstore\server.crt"
SSLCertificateKeyFile "C:\xampp\apache\conf\mibstore\server.key"
</VirtualHost>
<VirtualHost _default_:443>
ServerAdmin admin#localhost
DocumentRoot "C:/xampp/htdocs/secondsite"
ServerName secondsite.in:443
ServerAlias www.secondsite.in:443
ErrorLog "logs/example-error.log"
CustomLog "logs/example-access.log" common
SSLEngine on
SSLCACertificateFile "C:\xampp\apache\conf\ricebazzar\ca_bundle.crt"
SSLCertificateFile "C:\xampp\apache\conf\ricebazzar\server.crt"
SSLCertificateKeyFile "C:\xampp\apache\conf\ricebazzar\server.key"
</VirtualHost>
I have obtained SSL certificate from sslforfree and stored them on relevant path
I also edited etc\hosts file
127.0.0.1 firstsite.in
127.0.0.1 secondsite.in
Issue
I can able to browse them from the server(windows) itself , but can't able to access them from outside. the relevant domain names are purchased and added a A record to point the IP.
Notes
Using Amazon AWS EC2 instance
Added Inbound Rules on 80 & 443, And also added firewall rules on 80 & 443
Would you tried in another PC to visit them since you changed your host file on your PC.
If they can be visited then you need remove the record of your host file.
If not, please try:
Does both the A record of WWW and Non-WWW have been pointed to IP.
If pointed, please tell me what error or message you see on browser when you load the websites.
If there're no error or message which means they are blank page, please try to check is there any htaccess file, do you enable the rewrite mod of xampp.
Related
I need to create a reverse proxy in apache2 for an icecast server, but with another virtualhost as a simple website
I managed to create the reverse proxy, using this configuration in apache Virtualhost
<VirtualHost 100.100.100.100:80>
ServerName icecast.xxx.com
ProxyPass / http://localhost:8000/
</VirtualHost>
100.100.100.100 is the ip of the server, and xxx.com is the domain
So when i type in my browser icecast.xxx.com the icecast admin panel (on 8000 port) show up
Then i have added another virtualhost
<VirtualHost *:80>
ServerName xxx.com
ServerAlias www.xxx.com
ServerAdmin MY_EMAIL
DocumentRoot /var/www/site/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I have enabled him with sudo a2ensite NAME_OF_THE_CONFIG_FILE
But when I go to the ip of the VPS or to xxx.com/www.xxx.com the icecast2 admin panel show up!
I don't know how to solve this, I maybe think that the error is in the line
I finally managed to solve the issue,
simply in the reverse proxy virtualhost, instead of <VirtualHost 100.100.100.100:80>
I need to put
<VirtualHost *:80>
I'm developing locally using wamp and i've configured the enviroment to handle more than one site, but i want to access a specific site using an ip address, i don't know if i have to add a port after the 127.0.0.1.
The following are my host settings.
127.0.0.1 localhost
127.0.0.1 www.site1.net
127.0.0.1 www.site3.com
and on vhosts.
<VirtualHost *:80>
ServerAdmin www.site1.net
DocumentRoot "c:/wamp/site1/"
ServerName www.site1.net
ServerAlias www.site1.net
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin www.site2.com
DocumentRoot "c:/wamp/site2/"
ServerName www.site2.com
ServerAlias www.site2.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
Problem
When i put 127.0.0.1 in my address bar it goes to site1, and i don't know how to access site2 using ip.
Why i want this.
Because when i try to access this sites from another device on the same network they don't work unless i use this ip: 172.20.10.4, this on the iphone, and this ip goes to localhost which is site1 and then i can't access site2.
But just www.site.net or www.site2.com works on the machine running wamp.
Edit. This is what is tried.
I put some ports on the 'listen' part of the httpd.confi;
Listen *:80
Listen *:8182
Listen *:8383
And changed htttpd-vhosts;
<VirtualHost *:80>
ServerAdmin localhost
DocumentRoot "c:/wamp/"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:8181>
ServerAdmin www.site1.net
DocumentRoot "c:/wamp/site1/"
ServerName www.site1.net
ServerAlias www.site1.net
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:8182>
ServerAdmin www.site2.com
DocumentRoot "c:/wamp/site2/"
ServerName www.site2.com
ServerAlias www.site2.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
This works on the devices, like on the iphone i can dial 172.20.10.4:8181 and it goes to site1 and 8182 goes to site two.
NEW PROBLEM
The url of the sites are now messed up, i can only access this sites by their ip with ports but not their domain names, so on the local machine 127.0.0.1:8181 goes to site 1 but www.site1.net doesn't find the server directory where this site is located.
OK
If you use an ip address (from another PC on your network ) and not a url like www.site2.com Apache will not know what site it should run so it always picks the first site it find in the VHost definition file and takes the connection there.
So if you want to access your sites from other PC's on your internal network you either have to run your own DNS Server ( bit complicated ) or on each of the other PC's you need to setup their HOSTS file to know about your 2 sites i.e.
HOSTS FILE ON YOUR OTHER PC's assuming your WAMPSevrer is running on 192.168.1.10
192.168.1.10 www.site1.net
192.168.1.10 www.site2.com
Now these other PC's can use the correct url i.e. www.site1.net or www.site2.com and the Apache server will know which site to send the connection to.
Now I think you mentioned a Phone. This is a little more complex as you cannot get to the HOSTS file on a phone ( possibly you can if you have jailbroken it )
So for this I used a bit of a work around.
I use Fiddler, its a tool for viewing whats going up and down the line between a browser and the server from the PC running the browser.
But you can also use it as a Proxy I think this is the documentation
Basically you set it up to listen for connections on lets say port 8888 and then you add a line to its existing script to tell it to go to a specific url when it sees connections on 8888, you can therefore use a url in the phone like 192.168.1.10:8888 to get to site1.net then change the script so it goes to site2.com
Its a bit conveluted but it worked for me.
Answer to second problem
You dont mention what version of WampServer or Apache you are using so I added a test for the version in the new lines.
You have made a few mistakes in the definition of your virtual hosts. See below for corrections
<VirtualHost *:80>
ServerAdmin me#mysite.net
DocumentRoot "c:/wamp/www"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
<Directory "D:/wamp/www">
AllowOverride All
<IfDefine APACHE24>
Require local
Require ip 192.168.2 <- change to your subnet first 3 quartiles
</IfDefine>
<IfDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
Allow from 192.168.2 <- ditto
</IfDefine>
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin me#site1.net
DocumentRoot "c:/wamp/www/site1"
ServerName www.site1.net
ServerAlias site1.net
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
<Directory "D:/wamp/www/site1">
AllowOverride All
<IfDefine APACHE24>
Require local
Require ip 192.168.2 <- change to your subnet first 3 quartiles
</IfDefine>
<IfDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
Allow from 192.168.2 <- ditto
</IfDefine>
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin me#site2.com
DocumentRoot "c:/wamp/www/site2"
ServerName www.site2.com
ServerAlias site2.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
<Directory "D:/wamp/www/site2">
AllowOverride All
<IfDefine APACHE24>
Require local
Require ip 192.168.2 <- change to your subnet first 3 quartiles
</IfDefine>
<IfDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
Allow from 192.168.2 <- ditto
</IfDefine>
</Directory>
</VirtualHost>
Basically you need to tell each apache which IP's can access each vhosts folder.
So you could keep your modified ports if you wish but keep the <Directory>...</Directory section.
Also check yor HOST file, it was probably a typo when you wrote your question but you have said your hosts file looks like this
127.0.0.1 localhost
127.0.0.1 www.site1.net
127.0.0.1 www.site3.com
It should be this:
127.0.0.1 localhost
127.0.0.1 www.site1.net
127.0.0.1 www.site2.com
it will complicate, please do not use the same server's ip address not or the same server name.. each computer has unique ip, so provide the right ip and do not dupilcate the sitename of your project.. if you have 192.168.1.1 for site1.come then you should use 192.168.1.100 for site2.com.. 127.0.0.1 represents only 1 server ip and 1 sitename only.. please be guided with these difference because calling two persons in one address might result in one and your expecting to have 2 simultiniously.. thanks!
I currently have this apache2 site configuration:
<VirtualHost *:80>
ServerAdmin admin#example.com
ServerName engine.com
ServerAlias www.engine.com
DocumentRoot /var/www/engine.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
If I type engine.com I just get a blank page.
My directory setup is like this
/var/www/engine.com/public_html/wp-content...
Localhost works fine and wordpress installation is triggered, but as I say engine.com just brings me a blank page.
Don't you need to add
engine.com 127.0.0.1
to your hosts file?
I have two installs of wordpress on a single Amazon EC2 server. One of them is just a regular wordpress install, the other being a wordpress network install, with WP Domain Mapping installed.
So let's say I have four domain names: site.example.com, multisite.example.com, multisite1.com and multisite2.com
All of the domain names are pointing to the same IP address. Multisite1.com and multisite2.com are domain mapped to blogs under the multisite.example.com wordpress network
On my server httpd.conf is setup as follows:
<VirtualHost *:80>
ServerAdmin root#localhost
DocumentRoot /persistent/html/site1
ServerName site.example.com
ErrorLog logs/site_error_log
CustomLog logs/site_access_log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin root#localhost
DocumentRoot /persistent/html/multisite
ServerName multisite.example.com
ErrorLog logs/multisite_error_log
CustomLog logs/multisite_access_log combined
</VirtualHost>
Right now, all of the domains seem to go to the right place - until I start getting to the wp-admin panel.
site.example.com/wp-admin and multisite.example.com/wp-admin appear to work fine.
multisite1.com/wp-admin and multisite2.com/wp-admin both seem to redirect to site.example.com/wp-admin instead of multisite.example.com/wp-admin.
I can't figure out why. I have tried putting all of the domain names in the virtual host as ServerAlias but it doesn't seem to have helped. I've also put in a wildcard ServerAlias under multisite.example.com as well, but no luck.
Any ideas? It is a bizarre install I know, but for the time being for other reasons, I have to get it to work this way. I will eventually separate the two.
Create a new sites-available entry for each of your sub-domain or virtual host for each sub-domain pointing to the same web root and reload the apache. After that all will work fine.
For e.g.
<VirtualHost *:80>
ServerAdmin root#localhost
DocumentRoot /persistent/html/multisite
ServerName multisite1.com
ErrorLog logs/multisite_error_log
CustomLog logs/multisite_access_log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin root#localhost
DocumentRoot /persistent/html/multisite
ServerName multisite2.com
ErrorLog logs/multisite_error_log
CustomLog logs/multisite_access_log combined
</VirtualHost>
Here is the problem, if you visit the site directorybest.net you will see the correct website (which is defined in apache). But if you go to the www version of the site a catch all site for and from IIS is displayed. I have no idea what this is causing this.
I have another site that already runs fine on apache from which I copied the info for DNS and vhost settings. I also have set the DNS up so that both sites point to the same ip address. Does anyone know why the www version of the site does not show the right website?
Here is the vhost information for both the working and non working site.
NameVirtualHost *
#non-working site
<VirtualHost *>
ServerAdmin admin#email.com
ServerName www.directorybest.net
ServerAlias directorybest.net *.directorybest.net
DocumentRoot "D:\WWW\DirectoryBest\2"
DirectoryIndex index.php
<Directory D:\WWW\DirectoryBest\2>
AllowOverride All
</Directory>
# Logfiles
ErrorLog D:\WWW\DirectoryBest\2\logs\error.log
CustomLog D:\WWW\DirectoryBest\2\logs\access.log combined
</VirtualHost>
#working site
<VirtualHost *>
ServerAdmin admin#email.com
ServerName www.directorybest.info
ServerAlias directorybest.info *.directorybest.info
DocumentRoot "D:\WWW\DirectoryBest\1"
DirectoryIndex index.php
<Directory D:\WWW\DirectoryBest\1>
AllowOverride All
</Directory>
# Logfiles
ErrorLog D:\WWW\DirectoryBest\1\logs\error.log
CustomLog D:\WWW\DirectoryBest\1\logs\access.log combined
</VirtualHost>
Ok so I was just informed that the company has had DNS problems before. And upon further checking the local DNS had not been updated and was still resolving to the old ip address.