WAMP virtualhost wont redirect - apache

Ok I had to move my web to a new host. However new one is running Win 7 ultimate instead of 2008 R2.
To make sure i wont forget something moved over the existing WAMP Apache/PHP versions (bin folders).
It all works fine, except that virtualhosts simply wont redirect to the new documentroot.
it includes the virtualhosts conf file.
NameVirtualHost 88.159.116.217:90 should redirect to
C:/wamp/www/update/ but instead still directs to C:/wamp/www/
This setup worked fine on the 2008 R2. But now its simply ignoring everything defined in the included vhost.conf.
No errors (except that if my software connects to 88.159.116.217:90 - the files are not found since its root folder instead of update).
Code:
ServerAdmin hidden
ServerName hidden
DocumentRoot "C:/wamp/www/update/"
CustomLog logs/rfpatch.log combined
ErrorLog logs/rfpatch_err.log
<Directory "C:/wamp/www/update/">
Options -Indexes MultiViews FollowSymLinks IncludesNoExec
AllowOverride None
AddOutputFilter Includes html
Order allow,deny
Allow from all
AddType application/zip .tmp
AddType application/zip .cab
<Files update.dll>
AddType application/x-httpd-php .dll
</Files>
</Directory>
I don't need a hosts file - I'm not using domains.
There is no admin access problem (uac is also disabled).
the included vhost conf file is loaded - but vhost definitions are ignored.
The Apache version is the same as it was in the 2008 R2 server.

I can only think of two things...
You've not restarted Apache. It needs to be restarted for configuration changes to take effect.
Your Browser is caching the old page... Close all browser windows and tabs, then open the page and press CTRL-F5 to do a hard refresh. Also try clearing the browser cache data, it sometime "remembers" redirects and uses them over and over.

Related

Xampp apache virtualhost

I have two "htdocs" folder for two websites. I named the folders "website1" and "website2".
As you can see, both folders are inside C:/xampp.
When I type "website1.com" on my browser, I want xampp to serve the files on folder "website1" and its subfolders/subfiles as needed.
When I type "website2.com" on my browser, I want xampp to serve the files on folder "website2" and its subfolders/subfiles as needed.
For simplicity, let's say the landing page is index.php (think of sign-in page). This is the page called when I type "website1.com" or "website2.com".
Then after I hit submit button on index.php, it will call main.php.
I edited two files.
For hosts file, I add the host name that I wanted to be resolved into my localhost. Since I want to serve both website1 and website2 on my local computer via xampp, I added the following lines on hosts file located on C:/Windows/System32/drivers/etc
127.0.0.1 website1.com
127.0.0.1 website2.com
I also edited the apache config file which is httpd.conf
I added the following after the line: Listen localhost:80
<VirtualHost website1.com:80>
DocumentRoot "C:\xampp\website1"
ServerName website1.com
<Directory "C:\xampp\website1">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
<VirtualHost website2.com:80>
DocumentRoot "C:\xampp\website2"
ServerName website2.com
<Directory "C:\xampp\website2">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
The current behavior with these configs is that:
Typing "website1.com" or "website2.com" directs me/loads the page properly. For simplicity, the index.php of website1 has just different text compared to website2.
The problem is, once I hit submit button and it tries to load main.php (DIFFERENT folder locations depending if website1 or website2 but SAME file name), I get the following error:
Any help would be appreciated. I am new to web development.
I am also new to this topic (virtual hosts). I happen to search for this because I am getting tired of renaming my htdocs folder. RIght now, when I want to test website1, I rename website1 folder to htdocs. I am thinking that if what I am trying is possible, it may save me time in the long run.

apache xampp virtual host makes error 403 windows

I simply want to enable the test.php file to be accessible via a virtualhost so I added just 127.0.0.1 test.localhost in the windows host file and
<VirtualHost *:80>
DocumentRoot "D:/Programmordner/test"
ServerName test.localhost
<Directory "D:/Programmordner/test">
require all granted
#<FilesMatch "^((test|test2).testdateiendung1|.+.testdateiendung2)$">
<FilesMatch "^(test.php)$">
Allow from All
</FilesMatch>
in httpd-vhosts.conf
Now if I add the second, it seems I even cannot open the default documentation website by clicking the admin-button on the apache interface, which should not be affected? If I erase the second the alterations in the windows host file doesnt affect anything and I can access all files in standard htdocs. I switched different versions like allow from all, access denied access granted but nothing changed
If somebody knows there is already which solves my problem, I will not grudge him however I looked for it and it did not help
I made several fixes and changed to Port 80 (without httpS :( ) and everything is running now.

Problems setting up roundcube virtualhost for every subscription on server

Im trying to finish the set up of roundcube by adding a virtualhost so every subscription on server will use the webmail.servername.com to access it.
I have uploaded this roundcube.conf file with the code:
<VirtualHost ip-one:7080 \ ip-two:7080 \ local-ip:7080>
ServerName roundcube.webmail
ServerAlias roundcube.webmail.*
ServerAdmin "fdmatte#gmail.com"
DocumentRoot "/var/www/roundcube/"
<Directory "/var/www/roundcube/">
Options +FollowSymLinks
DirectoryIndex index.php
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
</IfModule>
# This is needed to parse /var/lib/roundcube/.htaccess. See its
# content before setting AllowOverride to None.
AllowOverride All
order allow,deny
allow from all
</Directory>
The issues im having are the following:
Using this file when i access my a website like http://www.mywebiste.com it gets routed to http://mywebsite.com
When i access webmail.mywebsite.com roundcube gets loaded but it cant find included files like css and js
It only works correctly if i access the ip-one:7080, then it works fine load up all css and js and i can login, check and send emails.
Is there something wrong with my settings?
Im using a plesk 11.5.30
Redirect http://www.mywebiste.com -> http://mywebsite.com can be switched off in Domain's hosting setting it's "Preferred domain" dropdown
Second issue can appears if you have wildcard subdomain *.mywebiste.com, this is well know plesk 11.5 bug so you can just ask Paralles support for solution. (You can workaround it by youself via customizing virtual hosting templates, but you should know how all this plesk backend works).
It's works for ip-one:7080 because Plesk 11.5 don't configure nginx webmail's config for every domain, just for wildcard webmail.*. So, nginx choose "wrong" virtual server and point it to virtual server of this wildcard subdomain which has location "/internal-nginx-static-location/" where static files will be looking by nginx(he know that is is static files because Plesk apache module mod_aclr2 provide such info for him ), but this location point to vhost folder of subdomain.
It's maybe something else, but I can't say more accurate just by your description.

Server-side includes (SSI) stop working when on https (ssl)

My server side includes work fine when accessing the website through http, but when trying to access the site securely (which is all set up sweet) they just don't get included.
I'm using the following code in the one file inside my apache2/sites-enabled directory:
<Directory /var/www/html>
Options +Includes
AddType text/html .htm
AddOutputFilter INCLUDES .htm
</Directory>
Any ideas about where to look?
Got it. I had only put the above code into the virtualhost section for the ordinary port, not the ssl port.

Apache local configuration to resolve files correctly

I have just configured Apache and PHP to work on my local Mac OS X computer. Now PHP works fine, except when I try to load the files for my live sites. The live sites have separate directories and are sorted by client name etc.
I've created symlinks in the default root for the local web server documents. My issue is that Apache doesn't seem to want to load any of the relative paths that are found in the HTML pages. For example, I have src="/css/main.css" but Apache doesn't load the file, similarly for images, it just resolves as a file not found 404 error. I then thought it might be the symlinks so I copied the full directory into the Apache document root, and still had the same result.
I would really love to setup my local development environment to run Apache, PHP, MySQL to develop locally then publish when ready. I also tried the MAMP installation, and had the same issues.
First you might want to try using src="./css/main.css".
When dealing with multiple live sites I like to setup a single configuration file for each site with apache and then load them all together in the httpd.conf file.
for my setup it looks like this:
in
/etc/apache2/httpd.conf
I have:
# Begin virtual host directives.
Include conf/bortreb.conf
Include conf/rlmcintyre.conf
Include conf/laserkard.conf
Include conf/judyates.conf
and then in
/etc/apache2/conf/judyates.conf
I have:
<VirtualHost *:80>
#localhost site
ServerAdmin email#example.com
DocumentRoot "/home/r/Desktop/web/judyates"
ServerName localhost
ServerAlias judyates.localhost
ErrorLog "/home/r/Desktop/web/judyates/log/error_log.log"
ScriptAlias /cgi-bin/ "/home/r/Desktop/web/judyates/cgi-bin/"
<Directory "/home/r/Desktop/web/judyates">
Options Indexes FollowSymLinks
Options +ExecCGI
AddHandler cgi-script cgi pl py
AllowOverride Options
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
#live site
ServerAdmin email#example.com
DocumentRoot "/home/r/Desktop/web/judyates"
ServerName judyates.com
ServerAlias *.judyates.com
ErrorLog "/home/r/Desktop/web/judyates/log/error_log.log"
ScriptAlias /cgi-bin/ "/home/r/Desktop/web/judyates/cgi-bin/"
<Directory "/home/r/Desktop/web/judyates">
Options Indexes FollowSymLinks
Options +ExecCGI
AddHandler cgi-script cgi pl py
AllowOverride Options
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
This way works really well, because you can set the subdomain yoursite.localhost
to loop back to your home ip address.
With this setup, when I work on judyates.com on my computer and want to test anythig, I just go to judyates.localhost in my web browser.
I have about 5 other sites all set up this way in their own *.conf file, so they can each live in their own directories on my computer that exactly match the directories they'll be in on the server.
The key is to use virtual hosts to go to different sites based on the subdomain.
You can learn how to configure subdomains that point to yourself here:
http://digitalpbk.blogspot.com/2007/01/making-subdomains-on-localhost.html
My setup goes even one step further because I setup the server too. Whenever I want to update I load both the webfiles AND the apache config files, and that way the server exactly mirrors my local setup. The only difference is that the real judyates.com points to the server and not my home computer, so when people try to visit the site they get everything from the server.
Have you tried src="css/main.css"? That is, without the leading slash? If you have a leading slash there your files would have to be in a directory named css that was in the root directory of the webserver, and if I understand you correctly that's not the case.
EDIT: OK, from reading your comments it seems like you are not quite clear on how relative urls work. "/css/main.css" is not relative to the page's location in the directory tree. It means a file named "main.css" in a directory named "css" in the root directory of the webserver. When you put your files on the deployment server your css directory is at the webserver's root directory. But it sounds like you are currently putting the css directory in a subdirectory named for the client... so your css file is now living at "/clientname/css/main.css".
If I understand you correctly, you can do what you want by using relative urls. If your html file is in the same directory as the css directory you would need "css/main.css". If it's in a subdirectory of the directory that contains the css directory you would need "../css/main.css"- the ".." means the parent directory of the current directory. If you use relative urls they will continue to work as long as the relationship between the files doesn't change.
Here's a page on the subject that explains it adequately, I think: http://www.webreference.com/html/tutorial2/3.html. Was pretty much the first thing I found in Google though, so there are likely better explanations out there.
There are a number of Apache directives that you could use to do this, but if using relative urls would work for you (and if I understand you correctly it would) then that's likely to be a lot simpler and less likely to cause you further trouble.