I have this set up on a"gateway" Apache server. it then forwards to a second server (I do not want exposed.)
the main "www" server simply hosts a website and forwards subdomains
<VirtualHost *:80>
ServerName www.firewall.co.uk
DocumentRoot /var/www/html/www
</VirtualHost>
<VirtualHost *:80>
ServerName behind.firewall.co.uk
ServerAdmin root#localhost
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://192.168.0.53/
ProxyPassReverse / http://192.168.0.53/
SetEnv proxy-sendchunked 1
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ErrorLog /var/log/httpd/behind.firewall.co.uk.log
CustomLog /var/log/httpd/behind.firewall.err.log combined
</VirtualHost>
the problem is that if the _POST is very large (and by "very large" I mean about 20 drop downs in a form that is _POSTed) the gateway Apache server simply locks. It refuses to forward it properly (at all) and it will (in the end) time out for 60s before even doing anything. It doesn't refuse to forward it, it does nothing for 60s.
but if I swap the gateway servers around it works fine, i.e. a large post to behind.firewall.co.uk direct.
does anyone know what I am doing wrong, what setting I am missing to ensure _POSTs work? (note: smaller posts DO work, so I am assuming it's a setting somewhere, but these are only forms of 20 drop downs hardly cumbersome)
Related
I am using XAMPP and running PORT:8080. I am trying to set up a virtual host and have tried every thing on the internet to set it up but still finding it difficult.
It shows this ERROR on chrome
ERR_SSL_PROTOCOL_ERROR
and this ERROR on Firefox
Error code: SSL_ERROR_RX_RECORD_TOO_LONG
Please need help on this...
My vhosts.conf file
NameVirtualHost *:8080
<VirtualHost *:8080>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:8080>
DocumentRoot "C:/xampp/htdocs/lsapp/public"
ServerName lsapp.dev
ServerAlias www.lsapp.dev
SetEnv APPLICATION_ENV "development"
<Directory "C:/xampp/htdocs/lsapp/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
my windows host file
127.0.0.1 localhost
127.0.0.1 lsapp.dev
Source
A while back, Google purchased the .dev TLD (Top Level Domain). At that time, they announced that they had no plans for it and that they were only going to use it for internal purposes. For years, the .dev TLD was primarily used for developers and designers to use in their local development environments. It was considered general acceptable use and, as a result, developers everywhere are now running sites locally which may now be affected.
Recently Google announced that in a soon to be released update to Chrome, they will be forcing .dev to HTTPS. In short, this means that if you are running local sites using .dev AND running Google Chrome, you will find your site unreachable. Fortunately, there are a couple of options which are fairly simple to implement to get around this issue. Keep in mind that since .dev has been a standard TLD for local development for some time, this new policy by Google will affect you whether you are using DesktopServer or any other local development tool which utilizes the .dev TLD. This issue is NOT specific to DesktopServer.
In short you need to change your .dev extension to anything else. If you still want to use .dev in the virtual host than you can try this workaround:-
NameVirtualHost *:8080
<VirtualHost *:8080>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:8080>
DocumentRoot "C:/xampp/htdocs/lsapp/public"
ServerName dev.lsapp.com
ServerAlias dev.lsapp.com
SetEnv APPLICATION_ENV "development"
<Directory "C:/xampp/htdocs/lsapp/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
And in your windows host file:-
127.0.0.1 dev.lsapp.com
Don't forget to restart the server to load new changes.
if it doesn't work just type http://dev.lsapp.com:8080/ on your browser and it absolutely works thanks.
ATTN! I should mention this is all localhost. As in my machine, no servers or other jazz included.
I am really bad at configuring sites in apache, how ever I have the following config:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/image_upload_app
ServerAlias www.dev-imageuploadapp.com
<Directory /var/www/html/image_upload_app>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
And when ever I visit www.dev-imageuploadapp.com, I get a "The web page is not available" in chrome.
There are no errors in the access or the error log, after attempting to visit the page. Apache is running and the site is enabled.
The directory does exist and contains a index.php.
You need to set ip address of your site on DNS Servers. There is some free DNS Servers like https://www.cloudflare.com/. If you do in this way, you need to set delegated DNS Servers on your domain-holder site. Another try you can go to site to IP by http://{your-ip-address}/
Your browser needs to know which IP address is to use for a provided name. To enforce some values to localhost, you can add them into hosts file. Following line needs to be added:
127.0.0.1 www.dev-imageuploadapp.com
In /etc/hosts change the line:
127.0.0.1 localhost
To
127.0.0.1 localhost www.dev-imageuploadapp.com
I'm using wamp on localhost at c:\wamp\www\.
The project located under: c:\wamp\www\MyProj\public (root).
In file1.php (located in root) I have a link to some fake url (/services/.....).
I'm trying to redirect that url to other file service_router.php (in the same direction as file1.php).
I'm doing that in httpd.config:
<VirtualHost *:80>
ServerName 127.0.0.1
DocumentRoot c:\wamp\www\
<Directory "c:\wamp\www\">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/MyProj/public/services/*
RewriteRule . /MyProj/public/service_router.php
</VirtualHost>
But my WAMP refuses to restart.
What's wrong with my configurations?
Can I make a few suggestions.
If you want to use Virtual Hosts, and I consider that a very good idea. You need first to make sure that localhost still works and secondly it is a good idea to move you actual projects out of the \wamp\ folder structure.
So this would be a good starting point for your first ( of many ) VHOSTS
First create a new folder structure somewhere on any of your drives for example
C:\websites\project1\www
Now copy your project to the www folder.
Now setup the vhosts
# must be first VHOST so the that localhost and the wamp menu page still work
# Also makes this the default site so any randon hacks on your ip address
# will come here and hopefully be rejected because it only 'Allows' access
# from this machine ( see Allow Deny )
<VirtualHost *:80>
DocumentRoot "D:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "C:/wamp/www">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/websites/project1/www"
ServerName project1.dev
ServerAlias www.dqsc.old
Options Indexes FollowSymLinks Includes ExecCGI
<Directory "C:/websites/project1/www">
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
Unless you actually want to make this site available to the World can I suggest that you dont use Allow from all.
Try using or the second Allow line if you want to see your site from any machine on your internal network, just use the first 3 of the 4 quartiles of your ip address and it will allow access from any ip starting with those 3 quartiles.
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
Allow from 192.168.0
Now you need to amend your HOSTS file so that windows knows about your new domain name.
Edit c:\windows\system32\drivers\etc\hosts and add the new site name project1.dev like so, you will have to launch your editor 'Run as Administrator' as this file is protected by windows :-
127.0.0.1 project1.dev
Now restart the "DNS Client" service to refresh the windows dns cache so it see's your new domain name. Start a command window, again "Run as Administrator".
net stop "DNS Client"
net start "DNS Client"
You should now be able to enter http://project1.dev in a browser and it will find you new site.
Finally, once you test that your site is working, put the url rewrite coding in a .htaccess file in the root of your new project.
C:\websites\www\project1\.htaccess
Server is WAMP. I have 2 sugarcrm sites, one for production say, saved at www/folder1 , other for development say saved at www/folder2 . I am accessing them using IP address (say 66.102.0.0/folder1 and 66.102.0.0/folder2 ) . Browser saves 1 cookie (PHPSESSID) for both of them. If I login/logout to first site, it effects other site also. I can create subdomain at localhost like folder1.localhost and folder2.localhost but how IP based sub-domain is possible like, folder1.66.102.0.0 and folder2.66.102.0.0 (looks funny :) ) ?Or can I use different port for different folder, like 66.102.0.0:80 and 66.102.0.0:8080 ?Then will browser saved 2 cookies, if port is different on same ip address?I can't change login/logout, it's sugarcrm not core php. I can use different browsers but my boss is saying to make cookies separately. Or is there any browser Add-on that separates cookies based on folder?
Call session_set_cookie_params() to restrict the cookie to a particular folder:
$params = session_get_cookie_params();
session_set_cookie_params($params['lifetime'], '/folder1');
session_start();
Yes. Creating subdomains should solve your problem. I do this all the time.
If you are opening your site as 66.102.0.0 then your session is based on that url which is causing all the problems.
Note: Directories mentioned here are windows wamp specific but as long as you find the appropriate files, this applies to Apache in all OS's.
Step 1. Uncomment this line in your bin/apache/Apache*.*.*/conf/httpd.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Step 2. Make a virtual host entries in your bin/apache/Apache*.*.*/conf/extra/httpd-vhosts.conf file.
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "D:/wamp/www"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:/wamp/www/folder1"
ServerName folder1.localhost
ErrorLog "logs/folder1.localhost-error.log"
CustomLog "logs/folder1.localhost-access.log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:/wamp/www/folder2"
ServerName folder2.localhost
ErrorLog "logs/folder2.localhost-error.log"
CustomLog "logs/folder2.localhost-access.log" common
</VirtualHost>
Step 3. Restart wampserver / apache.
Step 4. Edit your hosts file. C:\Windows\System32\drivers\etc\hosts
Add in the entries.
127.0.0.1 folder1.localhost # You probably want 66.102.0.0 over here instead of 127.0.0.1
127.0.0.1 folder2.localhost
I have installed apache on Debian server, and setup some example sites but I would like to make a billing system and automatically update the Virtualhost details like ServerAdmin, ServerName, ServerAlias when order is completed.
My question is: Is it possible to update them with PHP?
Example site in the sites-available directory:
<VirtualHost *:80>
ServerAdmin info#example.org
ServerName example.org
ServerAlias www.example.org
DocumentRoot /srv/www/example.org/public_html/
ErrorLog /srv/www/example.org/logs/error.log
CustomLog /srv/www/example.org/logs/access.log combined
</VirtualHost>
With the proper write permissions, you can certainly do it. It does seem like you will want some seriously paranoid validation and testing before you restart apache after a write a new one because a malformed directive in there is a quick way to 500.
Edit: I'm not sure I would recommend giving your script the 'proper' write permissions in the first place.