When attempting to access a website i am attempting to host on my pc using WAMP i get the typical error code 403 forbidden. I have edited the apache config to allow all etc but still seem to get it, however i can see localhost and phpadmin from 127.0.0.1
Any other suggestions? i can attach my apache config or put it in a pastebin if needed
For reference im running Win10(64x) with WAMP Server 3.0.6 (64x)
I have followed multiple tutorials from youtube and stackoverflow but cannot seem to get it to work as most use commands given are from linux such as 'chmd' (i have used linux before therefor understand what this means but cant work out how to do the same thing via windows)
Try making virtual host and give access to all local user. Make sure you give access to
file -------> httpd.conf
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
#onlineoffline tag - don't remove
Require local
Require ip 192.168.0
</Directory>
Edit httpd-vhosts.conf As like:
file ------> httpd-vhosts.conf
# Virtual Hosts
<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp64/www
<Directory "c:/wamp64/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName smarthome
DocumentRoot "c:/wamp64/www/smarthome"
<Directory "c:/wamp64/www/smarthome/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Related
I have been working on this for a while, and I am trying to use .htaccess and .htpasswd. Here is what I have done:
Performed with Apache using Raspberry Pi 3B+ with DietPi installed.
I created a new .htpasswd file and proceeded to enter password that I wanted.
Next, I redirected to /etc/apache2/sites-enabled/ where I edited 000-default.conf and changed the line of code:
<VirtualHost *80>
ServerName www.example.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/etc/"
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^https://%{SERVER_NAME%{REQUEST_URI} [END,Ne,R=permanent]
</VirtualHost>
Everything here is the same, except replace "example" with my domain.
This did not affect my site, so I redirected to /etc/apache2/ where I edited apache2.conf and added the line of code:
<Directory /var/www/etc/>
DirectoryIndex index.php index.html
Options Indexes FollowSymLinks
AllowOverride None
Require all denied
</Directory>
Once again, everything here is the same. etc is the file that I want to password-protect. This made the page that I wanted to protect completely inaccessible, and when I changed AllowOverride and Require all it just made the page completely open. How can I make it so that a password is prompted when you try to access the directory?
I had a Wordpress server running on a windows based WAMP server and I just migrated over to my main Ubuntu Server. The first thing I did was move the database over and then the files. After pointing the Wordpress config file to the new database, the home page loaded right up!
The problem is that the nav links or any other link that is NOT the homepage loads a 404 error.
I have tried pointing my Virtualhost to the .htaccess file and then also re-saving the permalinks in wordpress.
Here is my current Virtual host file
Virtual Hosts:
<VirtualHost *:80>
ServerName WherehouseMKE.com
ServerAdmin info#wherehousemke.com
DocumentRoot /var/www/html
<Directory /var/www/html>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
My /etc/httpd/conf.d/phpMyadmin.conf has the following configurations
# phpMyAdmin - Web based MySQL browser written in php
#
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip xx.xx.xx.xxx
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
#Deny from All
Allow from xx.xx.xx.xxx
Allow from ::1
</IfModule>
</Directory>
<Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip xx.xx.xx.xxx
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
#Deny from All
Allow from xx.xx.xx.xxx
Allow from ::1
</IfModule>
</Directory>
# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<Directory /usr/share/phpMyAdmin/libraries/>
Order Deny,Allow
#Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/setup/lib/>
Order Deny,Allow
#Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/setup/frames/>
Order Deny,Allow
#Deny from All
Allow from None
</Directory>
# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc. This may break your mod_security implementation.
#
#<IfModule mod_security.c>
# <Directory /usr/share/phpMyAdmin/>
# SecRuleInheritance Off
# </Directory>
#</IfModule>
When I access at my page EC2 instance as
http://xx.xx.xx.xxx/phpmyadmin, I have You don't have permission to access /phpmyadmin on this server. error.
I made sure this ip address xx.xx.xx.xxx is my EC2's Elastic IP address.
phpMyadmin.conf has correct xx.xx.xx.xxx to allow.
I tried to follow the similar links of this, this and this.
But still have the error. What could be wrong with my error?
My EC2 instance has AWS linux OS installed.
Thanks
As per my understanding this configuration is related to PhpMyadmin. In order to load this configuration into Apache Web Server, Make sure Apache is loading all the configuration files from conf.d by looking into httpd.conf if you are using apache [Not Apache2] and apache2.conf [for Apache2].
Inside /etc/apache2/apache2.conf, you will find the following line, which includes those files:
# Include generic snippets of statements
Include conf.d/
[Refference]
You might have checked it still, it is one of the solution.
I have same error. Follow this link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html to do all owner and group changes. Did all as you did above, but it's getting that error. Finally after restarting httpd, I become able to connect.
from today, when I go to localhost (http://localhost) after launch WAMP, in Firefox, as usual, everything is normal, but Chrome says "Forbidden, You don't have permission to access / on this server."
Anyone can help me please ?
Edit: Solved it for me.
This is an IPv6 problem. Google must have just updated Chrome.
First of all ensure that your hosts file has the following line and that it is uncommented.
::1 localhost
Next, open up your Apache config (httpd.conf) and add the following to the listen section:
Listen [::1]:80
Next, you need to edit you Directory statements in httpd.conf or your vhosts files. They probably look something like this.
<Directory "C:\path">
Options Indexes FollowSymLinks
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
AllowOverride All
</Directory>
Add an extra line after the 'Allow from 127.0.0.1' so it looks like this
<Directory "C:\path">
Options Indexes FollowSymLinks
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
AllowOverride All
</Directory>
For anyone running into this problem this is what worked for me on apache 2.4.17
host file is here: C:\Windows\System32\drivers\etc
httpd.conf is here: C:\wamp64\bin\apache\apache2.4.17\conf
httpd-vhosts.conf is here: C:\wamp64\bin\apache\apache2.4.17\conf\extra
I made sure that localhost was enabled in my hosts file:
127.0.0.1 localhost
::1 localhost
just remove the # at the beginning of the line.
make sure this line in un-commented in your httpd.conf
Include conf/extra/httpd-vhosts.conf
In my file it was line 518.
then add this to your httpd-vhosts.conf file:
<VirtualHost *:80>
ServerAdmin somerandomdude#whaaat.com
DocumentRoot "c:/wamp64/www"
ServerName localhost
</VirtualHost>
Then restart WAMP.
I don't know if that's the cleanest way of doing it(probs not). but it worked pretty well for me.
It happens the same to me. From today I can not access with http://localhost to my wamp files with chrome.
In Firefox or Explorer I have no problems.
You can use 127.0.0.1 while the problem is solved.
I had the same problem. This is how I solved it out:
I first added ::1 to host file,usually found at C:\Windows\System32\drivers\etc
Then I went ahead an opened my Chrome browser. I went to settings>advanced settings>Open proxy settings (under the title system)
In the new window that pops up go to 'LAN settings' then make sure you check 'Automatically detect settings'
I got this error :
Warning: PDO::__construct() [<a href='pdo.--construct'>pdo.--construct</a>]: [2002] php_network_getaddresses: getaddrinfo failed: No such host is known. (trying to connect via tcp://1:3306) in Z:\work\...
My localhost/phpmyadmin works fine but I can't access localhost or 127.0.0.1 , I get a blank page with "Forbidden : You don't have permission to access / on this server."
I have nothing else running on my port 80
I modified my httpd.conf
DocumentRoot "z:/work/"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory "z:/work/">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</Directory>
Also added in my httpd-vhosts.conf
<Directory C:/Users/Alex/Documents/GitHub>
Order Deny,Allow
Allow from all
AllowOverride All
</Directory>
<Directory Z:/work>
Order Deny,Allow
Allow from all
AllowOverride All
</Directory>
<VirtualHost *:80>
DocumentRoot "Z:\work\mysite"
ServerName bullseye.local
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\Users\Alex\Documents\GitHub\Myproject"
ServerName framework.local
</VirtualHost>
And my phpmyadmin.conf is as follow
Alias /phpmyadmin "c:/wamp/apps/phpmyadmin3.5.1/"
<Directory "c:/wamp/apps/phpmyadmin3.5.1/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</Directory>
The code giving the error :
$host = 'localhost';
$user = 'root';
$pass = '';
$database = 'mydatabase';
$this->db = new PDO('mysql:dbname=' . $database . ';host=' .$host . ';charset=utf8', $user, $pass);
I get the same error using mysql or msqli instead of PDO
My suggestion would be to:
Undo all your changes to httpd.conf. Your changes have removed all knowledge Apache has of the WAMP homepage i.e. localhost.
Comment out the include of the virtual hosts config and check you can again access the WAMP homepage.
Make sure that WAMP is 'OffLine', this will keep the C:\ drive and c:\wamp folder secure.
Now to your Virtual hosts definitions:
In order to keep the wamp homepage working the first entry should be as below, note the Directory block should be part of the definition of the VirtualHost and the security definition makes sure you can only access the wamp homepage from 127.0.0.1(localhost)
###must be first so the the wamp menu page loads
<VirtualHost *:80>
ServerAdmin webmaster#homemail.net
DocumentRoot "D:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "D:/wamp/www">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
</VirtualHost>
Each VHOST you define should contain its own security settings like this
<VirtualHost *:80>
DocumentRoot "Z:\work\mysite"
ServerName bullseye.local
ServerAlias bullseye.local
AllowOverride All
<Directory "Z:\work\mysite">
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\Users\Alex\Documents\GitHub\Myproject"
ServerName framework.local
ServerAlias www.framework.local
<Directory "C:\Users\Alex\Documents\GitHub\Myproject">
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
Uncomment the Include in https.conf for your vhosts definitions and try accessing you other projects again.
I assume you have made the required changes to your c:\windows\system32\drivers\etc\hosts file to include a reference to all you virtual hosts? If not the hosts file should look like this :-
127.0.0.1 localhost
127.0.0.1 framework.local
127.0.0.1 bullseye.local
My concern is this:
DocumentRoot "z:/work/"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory "z:/work/">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</Directory>
Unfortunately I don't have time to test this before I suggest it... but if DocumentRoot is z:/work/ then Directory / is also z:/work/ and you have set that to deny all and override none. Later trying to change the permission with Directory "z:/work/" would be considered an override and therefore not be applied? I suggest you try changing the AllowOverride to all or removing the deny all from / before you spend too much time hunting down other possible solutions.