WampServer 3.0.0 AH01630: client denied by server configuration: - php

Setting up a new dev server to work on PHP7 and get some training in and run across an impasse.
I can access the server from localhost, 127.0.0.1 no problem. However when I go to another computer on the LAN. I get the dreaded:
Forbidden
You don't have permission to access /dev/lab.php on this server.
So just to be on the safe side I used the new interface to see how the new setup would create a vhost. The vhost works fine locally but not from another PC on the LAN. The apache_error.log shows:
[authz_core:error] [pid 3408:tid 928] [client 192.168.1.38:54761] AH01630: client denied by server configuration: C:/wamp64/www/dev/lab.php
From everything I was reading it should have been a simple change of this
<VirtualHost *:80>
ServerName dev
DocumentRoot c:/wamp64/www/dev
<Directory "c:/wamp64/www/dev/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Which you can see I changed the Require local to Require all granted.
No JOY!
Still getting Forbidden access on the other LAN PC.

Once I changed the localhost to all granted. The sub-directories started working. Then I could get to http://192.168.1.36/dev with no problem.
<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp64/www
<Directory "c:/wamp64/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

Thanks for the tips. i was stuck with WampServer Version 3.0.6 64bit access (Apache Version 2.4.23) and this code worked.
<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp64/www
<Directory "c:/wamp64/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

in case if you have changed port no of apache server you have to give same port no in below configuration. for example if your apache port no is 8080 then it you need to replace existing code in httpd-conf file
<VirtualHost *:8080>
ServerName dev
DocumentRoot c:/wamp64/www/dev
<Directory "c:/wamp64/www/dev/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>

Related

Xampp Virtual Host Error 500

i use xampp on mac os and i want to add virtual host on it
i use this code on apaceh config
<VirtualHost 127.0.0.1:80>
ServerName mvcproject.local
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/mvcproject/public"
</VirtualHost>
<Directory "/Applications/XAMPP/xamppfiles/htdocs/mvcproject/public">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
and change my host like this
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 Masouds-MacBook-Pro.local # added by Apache Friends XAMPP
127.0.0.1 mvcproject.local
but i have this error
Server error!
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.
If you think this is a server error, please contact the webmaster.
Error 500
mvcproject.local
Apache/2.4.33 (Unix) OpenSSL/1.0.2o PHP/7.2.5 mod_perl/2.0.8-dev Perl/v5.16.3
How can i solve this problem?!
thanks.!
These are some point to help in create virtual host on mac
/Applications/XAMPP/xamppfiles/etc/httpd.conf in this file uncomment the
include line
Virtual hosts
Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
Add your site into vhosts file
/Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf
My custom host
<VirtualHost *:80>
ServerName mysite.local
DocumentRoot "/Users/yourusername/path/to/your/site"
<Directory "/Users/yourusername/path/to/your/site">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/mysite.local-error_log"
</VirtualHost>
Edit your host file
sudo nano /etc/hosts
#Add the following line
127.0.0.1 mysite.local
Restart your XAMPP

How to enable other public user to open up a firefox from your server in WAMP

I am using laravel 5.2 to create an API with my windows server, my API will open up a firefox browser.
When I am using "php artisan serve" in cmd to open 8000 port, the API works fine.
But when I setup virtual host in httpd.conf it can't open up the firefox, and return me "browser did not respond before timeout".
<VirtualHost *:80>
ServerName test.localhost
DocumentRoot "c:/wamp/www/test/public/"
Options Indexes FollowSymLinks
SetEnv APPLICATION_ENV "development"
<Directory "c:/wamp/www/test/public/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I have try to set up firewall to allow access all connection by port 80, but it still does not work for me.

Apache virtual host without domain name

I have a VPS with apache2 installed and I would like to access some PHP projects without a domain name just with the IP address. For example:
http://162.243.93.216/projecta/index.php
http://162.243.93.216/projectb/index.php
I have other projects with domain like example.com, in my directory /var/www/
/html/
info.php
/projecta/
/projectb/
/example/
When I go to
http://162.243.93.216/info.php then /var/www/html/info.php is opened.
My file 000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
" http://162.243.93.216/info.php then /var/www/html/info.php is opened "
I am assuming this already works (If not, uncomment the ServerAlias line shown in the conf below)
You now want to map
http://162.243.93.216/projecta/ to /var/www/projecta
http://162.243.93.216/projectb/ to /var/www/projectb
For this you need to use the Apache Alias directive.
Update your 000-default.conf file to:
<VirtualHost *:80>
# ServerAlias 162.243.93.216
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
Alias /projecta /var/www/projecta
Alias /projectb /var/www/projectb
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Create a new virtual host file, and setup like this:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerAlias 192.168.1.1
DocumentRoot /somewhere/public_html
<Directory /somewhere/public_html/>
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride Authconfig FileInfo
Require all granted
</Directory>
</VirtualHost>
add the serveralias and it will recognize the IP address as well ...
if you want to add more IP addresses (like local network second interface), you can add more serveralias lines ...
Step Six — Set Up Local Hosts File (Optional)
If you have been using example domains instead of actual domains to test this procedure, you can still test the functionality of your virtual hosts by temporarily modifying the hosts file on your "LOCAL COMPUTER". This will intercept any requests for the domains that you configured and point them to your VPS server, just as the DNS system would do if you were using registered domains. This will only work from "YOUR COMPUTER", though, and is simply useful for testing purposes.
Note: Make sure that you are operating on your local computer for these steps and not your VPS server. You will need access to the administrative credentials for that computer.
If you are on a Mac or Linux computer, edit your local hosts file with administrative privileges by typing:
sudo vi /etc/hosts
If you are on a Windows machine, you can find instructions on altering your hosts file here.
The details that you need to add are the public IP address of your VPS followed by the domain that you want to use to reach that VPS:
127.0.0.1 localhost
127.0.1.1 guest-desktop
server_ip_address example.com
server_ip_address example2.com
reference:https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-centos-7?utm_source=Customerio&utm_medium=Email_Internal&utm_campaign=Email_CentOSDistroNginxWelcome&mkt_tok=eyJpIjoiTnpWbU5tUTJPV1F5TVRBMyIsInQiOiJhd0JCQVI0NDd0ZWprUDFaaDlhbENcL0lyTjdSbnhwMEpkTE1QcXJTcHl1ZXFhNURKVmVBZHFKMk92RW1kSFwvMHowOW0zcExhaUdyOU42U2lLbk1Cd2FRYzB4XC9lbkhlWnd1ekZOcW1sZVhRYlwvT0xrTUpmQ2dEK2dNVUw4alFrc00ifQ%3D%3D

Configure multiple Kohana applications on one server

Currently I am using wamp on a windows machine and have kohana up and running for one site. I would like to deploy another site which is completely separate and uses a different copy of kohana. To do so I added file structure and deployed kohana as follows
+wamp
++www
+++site1
++++kohana
+++site2
++++kohana
Currently my apache httpd.conf listener is as follows
Listen 0.0.0.0:80
And my hosts file in the windows directory is set up as
127.0.0.1 localhost
127.0.0.1 site1.localhost
127.0.0.1 site2.localhost
Currently when I go to localhost it will go to site1.localhost. Or if i go to site1.localhost it will go to site 1. If I go to site2.localhost the application will redirect to site1.localhost
I am very new to LAMP so this may be a very basic issue, for that I apologize.
Creating a virtual host is the answer
<VirtualHost site1.localhost>
ServerAdmin webmaster#site1
ServerName site1
DocumentRoot "C:/wamp/www/site1"
<Directory "C:/wamp/www/site1">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/site1-error.log"
CustomLog "logs/site1-access.log" common
</VirtualHost>
<VirtualHost site2.localhost>
ServerAdmin webmaster#site2
ServerName site2
DocumentRoot "C:/wamp/www/site2"
<Directory "C:/wamp/www/site2">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/site2-error.log"
CustomLog "logs/site2-access.log" common
</VirtualHost>

Setup VirtualHost for Zend Application on Wamp server

I'm following this tutorial to learn how to start a project using ZendFramework
http://framework.zend.com/manual/1.12/en/learning.quickstart.create-project.html
When I get to setup a virtual host I get stuck. If I do exactly as the tutorial says, it shows me an error (in all my project, zend or not), says the file wasn't found.
Then I found this tutorial on StackOverflow very handy
Can't run zend framework MVC application on WAMP
Following what the guy on the bottom of the page says takes me to the same error when I try to access my app as zendProject.local/
This is what I got
on hosts (Windows/System32/drivers/etc/hosts) file
127.0.0.1 blog.local
on httpd-vhosts.conf file
<VirtualHost 127.0.0.1>
ServerName blog.local
DocumentRoot /blog/public
SetEnv APPLICATION_ENV "development"
<Directory /blog/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Can you tell me what I am doing wrong? The browser still says Not Found The requested URL /public was not found on this server when I go to http://blog.local/
I'm running WAMP on Windows. And this is the absolute path to the 'blog' project C:\wamp\www\blog
#Edit RiggsFolly
this is what I got now in the httpd-vhosts.conf file
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/wamp/www"
<Directory "C:/wamp/www">
AllowOverride All
# make sure this is only allowed to be accessed by the local machine
# then if/when you open one of your other sites up to the internet and somebody uses your IP
# they will get directed here as its the first VH def and then receive a 403 not allowed to access
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName blog.local
DocumentRoot "C:/websites/blog/public"
Options Indexes FollowSymLinks
SetEnv APPLICATION_ENV "development"
<Directory "C:/websites/blog/public">
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
And I created a new directory at C:/ called 'websites' as you suggested
You need to be a little more specific with your folder locations. I guess this tutorial was written for Unix and you are using windows.
For Apache 2.2.x use this syntax:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName blog.local
DocumentRoot "C:/wamp/www/blog/public"
Options Indexes FollowSymLinks
SetEnv APPLICATION_ENV "development"
<Directory "C:/wamp/www/blog/public">
DirectoryIndex index.php
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
You would be better avoiding the Allow from all and using Allow from localhost 127.0.0.1 ::1 until you actually want to allow the universe to see your sites.
For Apache 2.4.x use this syntax:
<VirtualHost *:80>
ServerName blog.local
DocumentRoot "C:/wamp/www/blog/public"
Options Indexes FollowSymLinks
SetEnv APPLICATION_ENV "development"
<Directory "C:/wamp/www/blog/public">
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
Note NameVirtualHost *:80 no longer required for Apache 2.4.x
Again you would be better avoiding the Require all granted and using Require local until you actually want to allow the universe to see your sites.
EDITED After comment from Questioner:
Right, that's the Apache default. If you enter a url it cannot find a Virtual Host definition for it will default to the first Virtual Host definition you gave it, the blog in your case.
Ok, so now you need to create a Virtual Host for each of your other projects, and MOST IMPORTANTLY the first one needs to be localhost and only be allowed to be accessed from the local PC for a bit of extra security.
Now personally I would take this opportunity to move my actual sites to a totally separate folder structure outside the \wamp\ folder structure so there is no confusion with rights given to the \wamp\www folder and my other sites.
So for example, create a folder c:\websites\www and in that folder create a folder for each of your projects eg
c:\websites\www\blog
c:\websites\www\project2
Then point your virtual hosts to the relevant folder containing the site code ( this can be on another disk if you like ). This allows you to specify the Apache security ( who is allowed in to this site) specifically for each of your VHOSTS. So when you want a client or friend to be able to play with one site, you just change the security on that one site while you let them play.
Like this:
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/wamp/www"
<Directory "C:/wamp/www">
AllowOverride All
# make sure this is only allowed to be accessed by the local machine
# then if/when you open one of your other sites up to the internet and somebody uses your IP
# they will get directed here as its the first VH def and then receive a 403 not allowed to access
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName blog.local
DocumentRoot "C:/websites/www/blog/public"
Options Indexes FollowSymLinks
SetEnv APPLICATION_ENV "development"
<Directory "C:/websites/www/blog/public">
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName project2.dev
DocumentRoot "C:/websites/www/project2"
Options Indexes FollowSymLinks
<Directory "C:/websites/www/project2">
DirectoryIndex index.php
AllowOverride All
Require local
# this site also available to other PC's on my internal network
Require ip 192.168.0
</Directory>
</VirtualHost>
Remember, for each new Virtual Host site you create you also need to add that ServerName (project2.dev) to the hosts file.
hosts file:
127.0.0.1 blog.local
127.0.0.1 project2.dev
I hope this helps.

Categories