Install magento twice on the same server - apache

I am making some test in one magento installation, but now i want to start again because all of the garbage i added to the first installation, but I need to keep it installed to see things on the admin panel and on the code...
How can I make this second installation? I tried once but the server, apache, redirects me to the second installation and I wasn't able to see the first again.
Thanks!

You can have as many installations as you want doing :
1) Creating the folders
/www/docs/magento01
/www/docs/magento02
2) Creating the virtual hosts (as vjtemplates said):
<VirtualHost *:80>
DocumentRoot /www/docs/magento01
ServerName local.magento01
<Directory "/www/docs/magento01">
SetEnv APPLICATION_ENV "development"
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /www/docs/magento02
ServerName local.magento02
<Directory "/www/docs/magento02">
SetEnv APPLICATION_ENV "development"
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
3) Change your HOSTS (if you working in your local machine)
ubuntu: /etc/hosts
windows: C:Windows\system32\drivers\etc\hosts.txt
And add the lines
127.0.0.1 local.magento01
127.0.0.1 local.magento02
4) Restart your server and type in your browser either local.magento01 or local.magento02 and you should be able to see your websites.
Cheers

On your Apache httpd-vhost.conf, you can add as many Document Root as you want.
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot /www/docs/dummy-host.example.com
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog #rel_logfiledir#/dummy-host.example.com-error_log
CustomLog #rel_logfiledir#/dummy-host.example.com-access_log common
</VirtualHost>

Related

How can I keep a global ServerName in apache working?

The Apache documentation is a bit unclear on the vhost configuration. Where I normally use wampserver, I discovered a discrepancy with XAMPP. Consider the fairly standard httpd.conf in the XAMPP distribution containing among other things:
ServerName localhost:80
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
</Directory>
And a empty httpd-vhosts.conf file. Everything works as advertised and the content of the xamp/htdocs folder is used (and redirects to /htdocs/dashboard)
As soon as a section is added to file httpd-vhosts.conf, for instance
<VirtualHost *:80>
ServerName customer01.localhost
DocumentRoot "D:/Customers/Customer01/httpdocs"
<Directory "D:/Customers/Customer01/httpdocs">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
And the proper amendments are made to .../etc/hosts. http://localhost stops working as it now redirects to D:/Customers/Customer01/httpdocs ignoring the ServerName setting in httpd.conf.
Is this by design?
If, however, in addition to the ServerName setting in httpd.conf the following is added to httpd-vhosts.conf:
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
things are fine again.
Why is the extra vhost needed as the global ServerName is already set in httpd.conf? Is this something the ApacheFriends should add to vhost by default?

XAMPP virtualhost site with all configs not working

I am trying to run site my.com locally on XAMPP's apache server. Here my configurations in httpd-vhosts.conf file in the path ...\XAMPP\apache\conf\extra:
<VirtualHost *:80>
DocumentRoot "D:/IDEs/XAMPP/htdocs"
ServerName localhost
<Directory "D:/IDEs/XAMPP/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:/IDEs/Websites/my.com"
ServerName my.com
<Directory "D:/IDEs/Websites/my.com">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Also, I remembered to add two lines in the hosts file, with is located in C:\Windows\System32\drivers\etc:
127.0.0.1 localhost
127.0.0.1 my.com
However, when I enter via link 'my.com' with enabled apache server, I've got only page with folder directories, which are in htdocs XAMPP's folder.
I have checked a lot of videos and stackoverflow questions, but nothing helped.
I would be pleased if you could help me with solving this issue.
first you should arrange directories on httpd.conf
example:
<Directory "C:/SERVER~1/web/site1">
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory "C:/SERVER~1/web/site2">
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
and then arrange vhosts.conf like this
example :
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.site1.com
DocumentRoot "C:/SERVER~1/web/site1"
</VirtualHost>
<VirtualHost *:80>
ServerName site1.com
DocumentRoot "C:/SERVER~1/web/site1"
</VirtualHost>
<VirtualHost *:80>
ServerName www.site2.com
DocumentRoot "C:/SERVER~1/web/site2"
</VirtualHost>
<VirtualHost *:80>
ServerName site2.com
DocumentRoot "C:/SERVER~1/web/site2"
</VirtualHost>
After five days-night of reading, searching, trying, I finnally fould the solution and done it in some steps:
First of all, forget about every file, and concentrate on the httpd-ssl.conf which is located in D:\IDEs\XAMPP\apache\conf\extra.
Second:
find the line "SSL Virtual Host Context" which has been commented. And below, find the line <VirtualHost _default_:443>.or simmilar. Then change it to <VirtualHost *:443>.
Third, change document root to the path of xampp's htdocs, for example, "D:/XAMPP/htdocs". Also, change ServerName from www.example.com:443 or similar, to localhost.
Here we done.
And Finally, after line </VirtualHost>, insert code
<VirtualHost *:443>
DocumentRoot "D:/IDEs/Websites/my.com"
ServerName my.com
<Directory "D:/IDEs/Websites/my.com">
Require all granted
</Directory>
</VirtualHost>
Change Document Root and Directory paths to your website location. And Servername to your server name.
RESTART APACHE
it works for me.
I also understood than some website uses SSL on localhost while the others not.
SO if you have exception like Apache/2.4.37 (Win32) OpenSSL/1.0.2p PHP/7.0.33 Server at my.com Port 443 you shold add your virtualhost configs into httpd-ssl.conf file.
If you got like ... Port 80 add yourl virtualhost configs into httpd-vhosts.conf

Apache vhost always show me the same content on different subdomains

I have two subdomains on my VPS, i have registered the two subdomains in my DNS pointing to the same IP address.
the version installed is Server version: Apache/2.4.7 for Ubuntu 12.04.
I've enabled the sites with the a2ensite command and i have enable the module vhost_alias. restart and reloaded many times
stable.mydomain.com
<VirtualHost *:80>
ServerName stable.mydomain.com
DocumentRoot /var/www/stable/web
<Directory /var/www/stable/web>
Options Indexes FollowSymLinks Includes
AllowOverride All
order allow,deny
Allow from all
</Directory>
</VirtualHost>
beta.mydomain.com
<VirtualHost *:80>
ServerName beta.mydomain.com
DocumentRoot /var/www/beta/web
<Directory /var/www/beta/web>
Options Indexes FollowSymLinks Includes
AllowOverride All
order allow,deny
Allow from all
</Directory>
</VirtualHost>
my trouble is pointing my browser to any url always i get the same content and to add more confusion when i execute service apache2 reload in the two subdomains i get the content from beta.mydomain.com and when execute service apache2 restart in the two subdomains i get the content of stable.mydomain.com.
I have spent about 5 hours trying to fix this
update
event i try with the VirtualDocumentRoot
<Virtualhost *:80>
VirtualDocumentRoot "/var/www/%1/web"
ServerName stable.mydomain.com
ServerAlias *.mydomain.com
UseCanonicalName Off
<Directory "/var/www/*">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</Virtualhost>
with the same behavior explained before this update
Have you uncommented this line before defining the virtual hosts?
NameVirtualHost *:80

Apache vhost not working for subdomains

I have this configuration but both url app.test.com & stage.test.com
redirect to same code/deployment
<VirtualHost *:80>
ServerName app.test.com
DocumentRoot /var/www/html/Test-Prod/web
<Directory "/var/www/html/Test-Prod/web">
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
ErrorLog logs/test-prod__error_log
CustomLog logs/test-prod_access_log common
</VirtualHost>
<VirtualHost *:80>
ServerName stage.test.com
DocumentRoot /var/www/html/Test/web
<Directory "/var/www/html/Test/web">
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
ErrorLog logs/test-website_error_log
CustomLog logs/test-website_access_log common
</VirtualHost>
The usual error for this is leaving out the NameVirtualHost directive if you're still using httpd 2.2
Add the following in your config file and it'll probably work
NameVirtualHost *.80
You might want to read the documentation for Named-based Virtual Host Support with httpd 2.2.
NameVirtualHost *.80
<VirtualHost localhost:80>
ServerName color
ServerAlias localhost
ServerPath "C:/wamp/www/subwww/color"
DocumentRoot "C:/wamp/www"
<Directory "C:/wamp/www/subwww/color">
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
in above code, subdomain name is color
and the url is http://color.localhost/
if the operating system is windows then add "127.0.0.1 color.localhost" in "C:/windows/system32/dirvers/etc/hosts" with notepad run as administration

Windows 7 - XAMPP: vhost keeps redirecting

My hosts file. (Win 7 ultimate)
127.0.0.1 localhost
127.0.0.1 efmm.local
My httpd-vhosts.conf (XAMPP 1.7.3)
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost efmm.local>
DocumentRoot "C:\xampp\htdocs\EFMM"
ServerName efmm.local
ErrorLog "logs/efmm.localhost-error.log"
CustomLog "logs/efmm.localhost-access.log" combined
<Directory "C:\xampp\htdocs\EFMM">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Problem
When I go to efmm.local , the browser redirects to localhost/EFMM.
I also tried <VirtualHost 127.0.0.1:80> instead of <VirtualHost efmm.local>, same result.
Here's how I do it on XP (don't expect it to make any difference in 7)
First, add the virtual host's domain to your HOST (as you did)
I don't put the virtual host webroot under the main htdocs directory. I create a specific webroot next to it, which gives me the following tree:
C:\XAMPP\htdocs
C:\XAMPP\htdocs-seconddomain
C:\XAMPP\htdocs-thirddomain
etc..
So in your case, I would create c:\XAMPP\htdocs-efmm alongside C:\XAMPP\htdocs
Then:
Edit XAMPP's httpd.conf, add and define any Apache options for the new document root, i.e.:
<Directory "C:/XAMPP/htdocs-efmm">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
[any extra apache module instructions you may require]
Order allow,deny
Allow from all
</Directory>
Edit XAMPP's httpd-vhosts.conf, adding the virtual host:
<VirtualHost *:80>
ServerName efmm.local
ServerAlias www.efmm.local
DocumentRoot "C:/XAMPP/htdocs-efmm"
ErrorLog "C:/XAMPP/htdocs-efmm/error.log"
DirectoryIndex index.php index.html index.htm
</VirtualHost>
Restart XAMPP. You may browse your new virtual host now.