Subdomain with Xampp + Cloudflare - xampp

I install Xampp on Windows VPS.
I add subdomains with Cloudflare:
subdomain1 xxx.xxx.xxx.xxx
subdomain2 xxx.xxx.xxx.xxx
subdomain3 xxx.xxx.xxx.xxx
This this httpd-vhosts.conf content:
<VirtualHost xxx.xxx.xxx.xxx:80>
ServerAdmin webmaster#mydomain.com
DocumentRoot "E:/"
ServerName xxx.xxx.xxx.xxx
ServerAlias www.xxx.xxx.xxx.xxx
ErrorLog "logs/mydomain.com-error.log"
CustomLog "logs/mydomain.com-access.log" common
</VirtualHost>
<VirtualHost subdomain1.mydomain.com:80>
ServerAdmin webmaster#mydomain.com
DocumentRoot "E:/subdomain1"
ServerName subdomain1.mydomain.com
ServerAlias www.subdomain1.mydomain.com
ErrorLog "logs/subdomain1.mydomain.com-error.log"
CustomLog "logs/subdomain1.mydomain.com-access.log" common
<Directory "E:/subdomain1">
Options All
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost subdomain2.mydomain.com:80>
ServerAdmin webmaster#mydomain.com
DocumentRoot "E:/subdomain2"
ServerName subdomain2.mydomain.com
ServerAlias www.subdomain2.mydomain.com
ErrorLog "logs/subdomain2.mydomain.com-error.log"
CustomLog "logs/subdomain2.mydomain.com-access.log" common
<Directory "E:/subdomain2">
Options All
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost subdomain3.mydomain.com:80>
ServerAdmin webmaster#mydomain.com
DocumentRoot "E:/subdomain3"
ServerName subdomain3.mydomain.com
ServerAlias www.subdomain3.mydomain.com
ErrorLog "logs/subdomain3.mydomain.com-error.log"
CustomLog "logs/subdomain3.mydomain.com-access.log" common
<Directory "E:/subdomain3">
Options All
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Now I browse from my own PC:
http://xxx.xxx.xxx.xxx --> It shows content of E:\index.html -->RIGHT!
http://subdomain1.mydomain.com --> It shows content of E:\subdomain1\index.html -->RIGHT!
But:
http://subdomain2.mydomain.com --> It doesn't shows content of E:\subdomain2\index.html --> show content of E:\index.html -->WRONG
http://subdomain3.mydomain.com --> It doesn't shows content of E:\subdomain3\index.html --> show content of E:\index.html --> WRONG
Same with other subdomain 4, 5, 6...
I wonder why only subdomain1.mydomain.com show correctly.
Please help

Solved.
Remove block:
<VirtualHost xxx.xxx.xxx.xxx:80>
ServerAdmin webmaster#mydomain.com
DocumentRoot "E:/"
ServerName xxx.xxx.xxx.xxx
ServerAlias www.xxx.xxx.xxx.xxx
ErrorLog "logs/mydomain.com-error.log"
CustomLog "logs/mydomain.com-access.log" common
</VirtualHost>

Related

Laravel .htaccess run another project on url

I have two projects on the same machine, both projects should be configured on a subdomain, currently at a time only a one project works if other one closed/shutdown
NameVirtualHost *
<VirtualHost *>
DocumentRoot /var/www/vhosts/client-portal/public
</VirtualHost>
<VirtualHost *:80>
ServerName subdomain.maindomain.com/
ServerAlias www.subdomain.maindomain.com/
DocumentRoot /var/www/vhosts/client-portal/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/vhosts/client-portal/public">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName subdomain.maindomain.com/admin-panel
ServerAlias www.subdomain.maindomain.com/admin-panel
DocumentRoot /var/www/vhosts/admin-panel/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/vhosts/admin-admin/public">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
If I turned off client-portal subdomain.maindomain.com/admin-panel works, otherwise if client-portal turns on subdomain.maindomain.com/admin-panel URL handled by client-portal.

I have port 8080 but if i don't use in link adres :8080 isn't working

I have port 8080 but if i don't use in link adres :8080 site looks like this enter image description here What am I doing wrong?
hots:
127.0.0.1 danzuz.eu
127.0.0.2 wordpress1.danzuz.eu
127.0.0.3 wordpress2.danzuz.eu
httpd-vhosts.conf:
<VirtualHost 127.0.0.1:8080>
ServerAdmin webmaster#danzuz.eu
DocumentRoot "C:/xampp/htdocs/"
ServerName danzuz.eu
ServerAlias danzuz.eu
ErrorLog "logs/danzuz.eu-error.log"
CustomLog "logs/danzuz.eu-access.log" common
<Directory "C:/xampp/htdocs/www/">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost 127.0.0.2:8080>
ServerAdmin webmaster#wordpress1.danzuz.eu
DocumentRoot "C:/xampp/htdocs/www/danzuzeu"
ServerName wordpress1.danzuz.eu
ServerAlias wordpress1.danzuz.eu
ErrorLog "logs/wordpress1.danzuz-error.log"
CustomLog "logs/wordpress1.danzuz-access.log" common
<Directory "C:/xampp/htdocs/www/danzuzeu">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost 127.0.0.3:8080>
ServerAdmin webmaster#wordpress2.danzuz.eu
DocumentRoot "C:/xampp/htdocs/www/wordpress"
ServerName wordpress2.danzuz.eu
ServerAlias wordpress2.danzuz.eu
ErrorLog "logs/wordpress2.danzuz-error.log"
CustomLog "logs/wordpress2.danzuz-access.log" common
<Directory "C:/xampp/htdocs/www/wordpress">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Thanks for help :( and sorry if i make wrong with my post it is my first time and sorry for my english

How to configure apache2 vhosts for difference www director on mac 10.11

I want to configure vhost for difference from www as below configure but it not work it.
<VirtualHost *:80>
ServerAdmin com.dev
DocumentRoot "Applications/AMPPS/www/com/public"
ServerName com.dev
ErrorLog "/private/var/log/apache2/com.dev-error_log"
CustomLog "/private/var/log/apache2/com.dev-access_log" common
</VirtualHost>
This one I have try to another director but it still go to localhost only
<VirtualHost *:80>
ServerAdmin com.dev
DocumentRoot "/usr/docs/web/com/public"
ServerName com.dev
ErrorLog "/private/var/log/apache2/com.dev-error_log"
CustomLog "/private/var/log/apache2/com.dev-access_log" common
</VirtualHost>
Host
127.0.0.1 com.dev

403 Forbidden apache mac os

Help set up a virtual host. In the file /etc/apache2/httpd.conf I uncommented this line here:
# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf
Next, the file is opened, and in the end ordered a new virtual host:
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Library/WebServer/Documents/"
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot "/Users/igor/sites/advanced"
ServerName advanced
ErrorLog "/private/var/log/apache2/lab.domain-error_log"
CustomLog "/private/var/log/apache2/lab.domain-access_log" common
<Directory "/Users/igor/sites/advanced/">
Options Indexes MultiViews
AllowOverride All
Allow from all
Require all granted
</Directory>
</VirtualHost>
Then added to the hosts 127.0.0.1 advanced. Restart Apache, but the browser displays a 403 error! What could it be?

Two Copies of Magento Installation on Localhost

My goal is two have two versions of Magento installed in my Sites/ folder. One is the current version we are using (1.12), and the other is the upgraded version (1.14). There are several reasons why I need to do this.
Another developer upgraded Magento and sent over the site files, which I put in Sites/magento2.dev, and I also have the working original in Sites/magento1.dev.
I created a separate database, imported the dump from the upgraded version, and put this in the local.xml file for magento2:
<host><![CDATA[localhost]]></host>
<username><![CDATA[root]]></username>
<password><![CDATA[mypassword]]></password>
<dbname><![CDATA[mydatabase]]></dbname>
<active>1</active>
Then I went into the database and changed the core_config_data base urls for our three websites to mimic what I had set on the older version:
http://www.magento2.dev/
http://www.magento2-b.dev/
http://www.magento2-c.dev/
I updated my /etc/apache2/extra/httpd-vhosts.conf file:
# Virtual Hosts
# Note: You also need to edit the hosts file /private/etc/hosts
NameVirtualHost *:80
#magento1.dev / Magento 1.12
<VirtualHost *:80>
ServerAdmin myuser#mywebsite.com
DocumentRoot "/Users/myuser/Sites/magento1.dev"
<Directory "/Users/myuser/Sites/magento1.dev">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ServerName magento1.dev
ErrorLog "/private/var/log/apache2/magento1.dev-error_log"
CustomLog "/private/var/log/apache2/magento1.dev-access_log" common
</VirtualHost>
#magento-b.dev / Magento 1.12
<VirtualHost *:80>
ServerAdmin myuser#mywebsite.com
DocumentRoot "/Users/myuser/Sites/magento1.dev"
ServerName magento1-b.dev
ErrorLog "/private/var/log/apache2/magento1-b.dev-error_log"
CustomLog "/private/var/log/apache2/magento1-b.dev-access_log" common
</VirtualHost>
#magento-c.dev / Magento 1.12
<VirtualHost *:80>
ServerAdmin myuser#mywebsite.com
DocumentRoot "/Users/myuser/Sites/magento1.dev"
ServerName magento1-c.dev
ErrorLog "/private/var/log/apache2/magento1-c.dev-error_log"
CustomLog "/private/var/log/apache2/magento1-c.dev-access_log" common
</VirtualHost>
#magento2.dev / Magento 1.14
<VirtualHost *:80>
ServerAdmin myuser#mywebsite.com
DocumentRoot "/Users/myuser/Sites/magento2.dev"
ServerName magento2.dev
ErrorLog "/private/var/log/apache2/magento2.dev-error_log"
CustomLog "/private/var/log/apache2/magento2.dev-access_log" common
</VirtualHost>
#magento2-b.dev / Magento 1.14
<VirtualHost *:80>
ServerAdmin myuser#mywebsite.com
DocumentRoot "/Users/myuser/Sites/magento2.dev"
ServerName magento2-b.dev
ErrorLog "/private/var/log/apache2/magento2-b.dev-error_log"
CustomLog "/private/var/log/apache2/magento2-b.dev-access_log" common
</VirtualHost>
#magento2-c.dev / Magento 1.14
<VirtualHost *:80>
ServerAdmin myuser#mywebsite.com
DocumentRoot "/Users/myuser/Sites/magento2.dev"
ServerName magento2-c.dev
ErrorLog "/private/var/log/apache2/magento2-c.dev-error_log"
CustomLog "/private/var/log/apache2/magento2-c.dev-access_log" common
</VirtualHost>
I updated my /private/etc/hosts file:
127.0.0.1 localhost
127.0.0.1 www.magento1.dev
127.0.0.1 www.magento1-b.dev
127.0.0.1 www.magento1-c.dev
127.0.0.1 www.magento2.dev
127.0.0.1 www.magento2-b.dev
127.0.0.1 www.magento2-c.dev
I have tried a few other iterations of this (adding trailing slashes, http, www, etc), always with the same result. When I go to www.magento2.dev, www.magento2-b.dev, or www.magento2-c.dev, I get a slightly different version (fonts broken) of my old version of the site (www.magento1.dev), but with the new URL. Logging into the backend, I can see that it is 1.12, and the URL changes to the older version. Basically it seems like I just made three new local domains for the old version of the primary store website.
I've restarted apache and mysql about a million times.
I should also note that if I got to http://localhost/~myuser/magento2.dev, I get a 403 notice.
What am I missing here?
First, match the ServerName in your httpd.conf with the corresponding domains you added in your local hosts file. Also try viewing the logs i realtime when you visit any of the urls in your browser.
$ cd /private/var/log/apache2/
$ tail -f magento1-b.dev-error_log
You can also tail all the log files at once to see which vhost gets a hit when visiting any of the localhost host file domains in your browser.
$ cd /private/var/log/apache2/
$ tail -f *.log
Also, test if the vhost's are working by creating a simple .php file in Magento root and visit it with your browser. For example, create /Users/myuser/Sites/magento1.dev/info.php with the following content:
<?php
echo gethostname() . "\n";
echo getcwd() . "\n";
?>
Visit http://www.magento1.dev/info.php
Visit http://www.magento2.dev/info.php
Verify local hosts file (Mac)
127.0.0.1 www.magento1.dev
127.0.0.1 www.magento1-b.dev
127.0.0.1 www.magento1-c.dev
127.0.0.1 www.magento2.dev
127.0.0.1 www.magento2-b.dev
127.0.0.1 www.magento2-c.dev
Otherwise, use this as a minimum httpd.conf (with matching ServerName. This currently works in my local MAMP environment.)
NameVirtualHost *
<VirtualHost *>
DocumentRoot "/Users/myuser/Sites/magento1.dev"
ServerName www.magento1.dev
ErrorLog "/Users/myuser/Sites/magento1.dev-error_log"
CustomLog "/Users/myuser/Sites/magento1.dev-access_log" common
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/myuser/Sites/magento1.dev"
ServerName www.magento1-b.dev
ErrorLog "/Users/myuser/Sites/magento1-b.dev-error_log"
CustomLog "/Users/myuser/Sites/magento1-b.dev-access_log" common
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/myuser/Sites/magento1.dev"
ServerName www.magento1-c.dev
ErrorLog "/Users/myuser/Sites/magento1-c.dev-error_log"
CustomLog "/Users/myuser/Sites/magento1-c.dev-access_log" common
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/myuser/Sites/magento2.dev"
ServerName www.magento2.dev
ErrorLog "/Users/myuser/Sites/magento2.dev-error_log"
CustomLog "/Users/myuser/Sites/magento2.dev-access_log" common
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/myuser/Sites/magento2.dev"
ServerName www.magento2-b.dev
ErrorLog "/Users/myuser/Sites/magento2-b.dev-error_log"
CustomLog "/Users/myuser/Sites/magento2-b.dev-access_log" common
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/myuser/Sites/magento2.dev"
ServerName www.magento2-c.dev
ErrorLog "/Users/myuser/Sites/magento2-c.dev-error_log"
CustomLog "/Users/myuser/Sites/magento2-c.dev-access_log" common
</VirtualHost>
If you have working vhost's, then check the index.php & .htaccess files within each copy of Magento for any hard-coded domain or store code occurrences.

Resources