VirtualBox Ubuntu 16.04 apache2 vhost jumping to https or not showing the page - apache

I am trying to set up some vhosts on a Virtual Box with Ubuntu 16.04 Apache2 PHP 7.0 to start moving the code to PHP7.
I have moved the v-host file from the older VBox which looked like this
<VirtualHost 192.168.2.174:80>
ServerName admin.ubuntu16.de
ServerAlias admin.ubuntu16.de
ServerAdmin email#company.de
DocumentRoot /home/www/public_html/workspace/admin
php_value auto_prepend_file '/home/www/public_html/workspace/admin/administration/conf/register_globals.php'
<Directory /home/www/public_html/workspace/admin>
Options Indexes FollowSymLinks MultiViews ExecCGI
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
But it kept on trying to load the page with https or saying that there is no access to site root folder
These settings work perfectly on Ubuntu 14 Virtuall Box with apache2 and PHP 5.5.something
So I followed the tutorial and changed it to simply
<VirtualHost 192.168.2.174:80>
ServerName admin.ubuntu16.de
ServerAlias admin.ubuntu16.de
ServerAdmin email#company.de
DocumentRoot /home/www/public_html/workspace/admin
</VirtualHost>
But now it just jumps straight to https mode
I obviously ran a2ensite
I also switched off the default site by running "a2dissite 000-default.conf"
I also enable modules to do with proxying and a bunch of others while getting appache to actuallly start :-)
Any ideas on things I might off missed are greatly appreciated.
Just a little edit:
All the files for the sites are situated on the main Windows machine and are imported through /media/sf-workspace
The symbolic link is then created as /home/www/public_html/workspace

I would first eliminate the symbolic links and just make a copy of all the files inside the virtual box to remove that variable.
Apache can be screwy with symlinks.

Related

Can't configure XAMPPto work with zend

Hi I'm trying to install ZF 1.12 with XAMPP .I read everything and did everything exactly as it was written,also configured the "httpd.conf" file like this:
<VirtualHost *:80>
DocumentRoot "/xampp/htdocs/<Your project folder>/public"
ServerName <Your project folder>
ServerAlias www.<Your project folder>
SetEnv APPLICATION_ENV "development"
<Directory "/xampp/htdocs/new/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
but now when i try to start the server i get the following message:
500 Internal Server Error
The server encountered an internal error or misconfiguration and was >unable to complete your request.
Is there anything else that needs to be done
Your Virtual Host definition is incomplete i.e no closing tag ( this may just have been missed when you copy/pasted.
Lets assume you have created and installed the Framework into /xampp/htdocs/project1/public
Lets also assume you want to run this site from a development domain called project1.dev i.e this is what you want to enter into the browser address bar.
Lets also assume you are using Apache 2.4.x and therefore need to use the Apache 2.4 syntax for access.
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/project1/public"
ServerName project1.dev
ServerAlias www.project1.dev
<Directory "C:/xampp/htdocs/new/public">
DirectoryIndex index.php
AllowOverride All
Require local
</Directory>
SetEnv APPLICATION_ENV "development"
</VirtualHost>
Now you need to edit the C:\windows\system32\srivers\etc\hosts and add these 2 lines.
127.0.0.1 project1.dev
::1 project1.dev
Now run this from a command windows launched using "Run as Administrator"
net stop dbscache
net start dnscache
And then restart Apache. Alternatively, just reboot.

How to route all *.dev to subfolders on vagrant box

I want that every *.dev Host will be routed to my vagrant machine to /var/www/vhosts/*.dev/public, for example my local development environment project1.dev is located in /var/www/vhosts/project1.dev/public
So when I add a new (sub)project into my box, I do not need to change my config.yaml (Vagrant installed via puphpet.com) and reload the machine.
On my computer, I added the following to the hosts file in /private/etc:
192.168.56.101 *.dev
On my VM, I changed my 10-default_vhosts80.conf in /etc/apache2/sites-enabled to:
# ************************************
# Vhost template in module puppetlabs-apache
# Managed by Puppet
# ************************************
<VirtualHost *:80>
ServerName default
## Vhost docroot
DocumentRoot "/var/www/default"
## Directories, there should at least be a declaration for /var/www/default
<Directory "/var/www/default">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
</Directory>
## Load additional static includes
## Logging
ErrorLog "/var/log/apache2/default_vhost_80_error.log"
ServerSignature Off
CustomLog "/var/log/apache2/default_vhost_80_access.log" combined
## Custom fragment
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/default/$1
</VirtualHost>
<VirtualHost *.dev:80>
ServerName dev
VirtualDocumentRoot /var/www/vhosts/%0
</VirtualHost>
Unfortunately, this doesn't work. Any ideas? I am a beginner in this subject.
I use a proxy auto configuration file. This works on Windows, MacOS and Linux. Easy, flexible and no additional software required. The following example routes all *.dev traffic to your vagrant box:
function FindProxyForURL(url, host) {
if (dnsDomainIs(host, ".dev")) {
return "PROXY 127.0.0.1:8080";
}
return 'DIRECT';
}
When needed, replace 127.0.0.1:8080 with the IP and webserver port of your vagrant box. Store this file somewhere. You can store it locally or let the webserver on your Vagrant-box host the file.
Windows: See here how to use the PAC file on Windows.
MacOS: See here how to use the PAC file on MacOS. You can link to the file using file:///Users/username/path/to/proxy.pac.
Linux: For linux it depends, but I'm sure linux users will be able to Google for their specific situation.
Unfortunately hosts files do not support using wildcards. You have to manually define each and every host to redirect.
Also, your hosts file is at /etc/hosts
In the end, I use dnsmasq to route all .localdev Domains to 127.0.0.1. Note that I am using .localdev instead of just .dev or .local as this seems to cause problem (OS X 10.10) because .dev is a proposed gTLD and .local is used by Apple's Bonjour.
Then I configured Apache by creating and enabling this site:
<VirtualHost *:80>
ServerAlias localhost *.localdev #wildcard catch all
VirtualDocumentRoot /hosts/%1/public
UseCanonicalName Off
<Directory "hosts">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
(from: http://brunodbo.ca/blog/2013/04/26/setting-up-wildcard-apache-virtual-host-wildcard-dns)

vhosts dont appear to be working on OS X Mavericks Apache installation

I am trying to set up the Apache server which comes with OS X Mavericks with vhosts so that a domain name resolves to my user level document webroot. I have followed this tutorial which guided me through setting up the apache server with php:
http://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-9-mavericks/
as well as this one which guided me through setting up the vhosts:
http://coolestguidesontheplanet.com/set-virtual-hosts-apache-mac-osx-10-9-mavericks-osx-10-8-mountain-lion/
Following these tutorials, if I type localhost in my browser it correctly resolves to the system level root (/Library/WebServer/Documents/ folder). If I use localhost/~myusername it correctly resolves to my user level root (/users/myusername/Sites/).
However, whenever I navigate to my domain, I get redirected to the system level root rather than my user level root.
My vhosts file reads as follows:
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Library/WebServer/Documents/
</VirtualHost>
<VirtualHost *:80>
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot "/Users/myusername/Sites/mydomain"
<Directory "/Users/myusername/Sites/mydomain">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Any ideas?
Have you enabled Virtualhosts?
NameVirtualHost *:80
And included your vhosts directory
Include <path>/vhosts/*
On a Macbook, you may need to include /private/ at the beginning of any absolute path, so that Apache can read it correctly off the file system.
For others who have the same problem...
It was frustratingly simple - I had missed the "" around the localhost directory.
How annoying!
Try starting apache manually with the -S option to see what the problem might be:
/usr/sbin/httpd -S

Only activate web sharing that I can use virtualhost with apache on Mac OS

I have configure httpd.conf and httpd-vhosts.conf, when I active the web sharing the virtualhost is useful, but when I close web sharing and start apache, the virtualhost doesn't work
Here is my virtualhost config
<VirtualHost *:80>
DocumentRoot "/Users/lch/Sites"
ServerName myhome.com
</VirtualHost>
<Directory "/User/lch/Sites">
Options None
Allow from all
</Directory>
And, here is error short-cut:
I am a newer for Mac OS, and I come from china.
Thank you for read my question.
Two things to check:
Is the include for httpd-vhosts.conf uncommented in httpd.conf? I believe it's commented out by default.
Have you added myhome.com to your hosts file? Make sure you've got the following entry in /etc/hosts: 127.0.0.1 myhome.com

Magento not accessible since tried to move to multi website setup. Apache issue?

I wish I had never seen this article:
http://www.magentocommerce.com/knowledge-base/entry/tutorial-multi-site-multi-domain-setup
I have Apache 2.2 installed on my XP machine and until a while ago I had a Magento site that I could test the development of a custom module on. I decided that I wanted to have multiple websites and multiple stores so that I could test that my modules configuration variables set at the different scopes (global, website, and store) were working as expected.
So I followed the instructions in the above Magento article. I created a website and gave it a name of “paulsplace.com”. I created a couple of Stores under that website. I then went to System/Configuration/General/Web and, with the scope set to paulsplace.com, I set the unsecured and secured URLs to http://paulsplace.com/ and https://paulsplace.com/ and hit Save Config - what a mistake!!
I got a 404 error. And now I can’t get to my magento front end or back end.
I tried a couple of things:
I added these lines to my hosts lookup file:
127.0.0.1 paulsplace.com
127.0.0.1 www.paulsplace.com
I then uncommented this line in my httpd,conf file:
Include conf/extra/httpd-hosts.conf
and added the following to the conf/extra/httpd-hosts.conf file:
<VirtualHost *:80>
ServerAdmin me#myemail.com
DocumentRoot "C:/Applications/Apache Software Foundation/Apache2.2/htdocs"
ServerName paulsplace.com
ErrorLog "logs/paulsplace.com-error.log"
CustomLog "logs/paulsplace.com-access.log" common
</VirtualHost>
and restarted Apache.
If I browse to “http://www.paulsplace.com” I now get a page that just says “It works!”. Same for “http://paulsplace.com” and “http://www.paulsplace.com/magento/index.php”.
I tried a few more things - I added this line to httpd.conf:
AccessFileName htaccess
(I did this because Windows Explorer didn’t let me create a file starting with a dot; I could do it from the command prompt, but I believe what I have done should be ok).
I changed AllowOverride to All from None:
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
<Directory "C:/Applications/Apache Software Foundation/Apache2.2/htdocs">
AllowOverride All
</Directory>
and in C:\Applications\Apache Software Foundation\Apache2.2\htdocs\htaccess (a file that I created), I entered:
SetEnvIf Host www\.paulsplace\.com MAGE_RUN_CODE=pws1
SetEnvIf Host www\.paulsplace\.com MAGE_RUN_TYPE=website
SetEnvIf Host ^paulsplace\.com MAGE_RUN_CODE=pws1
SetEnvIf Host ^paulsplace\.com MAGE_RUN_TYPE=website
(pws was the value I used for the “Code” when creating my store).
Please tell me how I can put this right. I feel like I’m taking one step forward and three backward at the moment.
Any help really would be greatly appreciated.
<VirtualHost *:80>
ServerAdmin me#myemail.com
DocumentRoot "Change this to point at your magento install"
ServerName paulsplace.com
ErrorLog "logs/paulsplace.com-error.log"
CustomLog "logs/paulsplace.com-access.log" common
SetEnv MAGE_RUN_TYPE website
SetEnv MAGE_RUN_CODE pws1
</VirtualHost>
If changing anything in System Configuration borks your system, you can always clear out the bad values in the database directly, and clear your Magento cache. Do a
select * from core_config_data where value LIKE '%paulsplace.com%'
This will give you the two rows that were added when you clicked save. Remove the rows. Next, clear out all the files in
var/cache/*
to clear your cache. Then restore your Apache config to what it was before you started monkeying around. This should restore your site back to its previous state, and you can continue to experiment with things.