I have found at least a dozen entries for this error even in this forum, and many outside. All are basically saying that inside <Directory></Directory>, I have "deny all" directive, and no "allow" directive.
I cannot write a fixed directory to match because it is created on the fly by a backend tomcat server.
When I entered "myUrl/test/request/user1/1234567890/download", I get
403 Forbidden: You don't have permission to access /test/request/user1/1234567890/download.
httpd error log shows:
[error] [client xxx.xx.xx.xxx] client denied by server configuration: /data/test, referer: myUrl/test/request/user1/1234567890
The part beginning with "test" is created by the backend tomcat, in which "user1" and "1234567890" vary, while the other parts of the directory structure remain fixed.
In my httpd.conf, I do have:
<VirtualHost *:80>
DocumentRoot /data
---
---
RewriteRule ^/test - [L]
---
</VirtualHost>
How do I solve this? Even if I create a different and create another document root, I will need a regex. Somewhere outside , I tried this:
<Directory "/data/test/request/*/*/download">
Options -Indexes -FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
But no success.
I am using "ajp" to talk to backend tomcat and have necessary module in place and I can telnet the backend tomcat server (on 8009) . So it should not be ajp communications problem.
The "test" piece in above url is actually a "context" inside /webapps directory of tomcat. Owner in that "test" context is tomcat, but I have added read permission for everyone.
First, I had to "deny all" for "/"
Directory
Deny from all
/Directory
Only then "Allow for all" for "/data"
Directory /data
---
---
Allow from all
/Directory
Then I rearranged RewriteRule, Redirect, ProxyPass, ProxyPassReverse inside the
VirtualHost *:80
/VirtualHost
and it worked!
Related
I am completely new to AWS . I am working with a team who are sitting in some other location. They had created an EC2 instance with 3 folders inside the /var/www/html/ directory namely say A,B,C. They attached an Elastic IP to that instance. Now when the browser is hit with 3 different URLs the corresponding folders get pointed and corresponding index.php is hit.
a.domain.com = Points to the folder A and opens index.php inside it
b.domain.com = Points to the folder B and opens index.php inside it
c.domain.com = Points to the folder C and opens index.php inside it
Just the Ip Address = Points to the folder A and opens index.php inside
it - I don't have an idea how
As instructed i created a Snapshot and created an AMI and launched my own EC2 instance with that.
I checked and changed my /etc/hosts file which something looks like this
127.0.0.1 localhost localhost.localdomain
#xx.x.x.xxx A B C
#xxx.xx.xx.xxx A B C
xxx.xx.xx.xxx a.domain.com b.domain.com c.domain.com # My private IP
127.0.0.1 a.domain.com b.domain.com c.domain.com
/etc/httpd/conf.d/vhost.conf :-
<VirtualHost *:80>
ServerName c.domain.com
DocumentRoot /var/www/html/C
ErrorDocument 404 /404-not-found.html
LogLevel warn
ErrorLog /etc/httpd/logs/c_log
TransferLog /etc/httpd/logs/c_web_log
<Directory "/var/www/html/C">
Options -Indexes +FollowSymLinks +Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Rest of the folders configured like the above.
service httpd restart
I am not sure why the above configuration is not allowing me to open or to point to either folders or open any when i hit the customized URL as above. I am a complete newbie to AWS.
I have two local Domain which work fine, however, the otherA domain is the API server that the otherB domain consumes API. The problem is it can't access the otherA domain, and returns network error something like
option 1
let apiserver = 'http://localserverA.local'
axios.get(`${apiserver}/apicall`).....
catch( ---> return network error
But this works
option 2
let apiserver = 'http://127.0.0.1:8000'
axios.get(`${apiserver}/apicall`).....
returns 200 ok
The problem with option 2 is to run php built in server which not a good idea because some set up in databases requires domain local host to access its data.
<VirtualHost *:80>
ServerName localserverA.local
ServerAlias localserverA.local
DocumentRoot C:/projects/r/projects/A/web
<Directory "C:/projects/r/projects/A/web">
AllowOverride All
Require all granted
Allow from All
Allow from 127.0.0.1
Allow from ::1
#FallbackResource /app.php
</Directory>
</VirtualHost>
I can even ping my domain name, it works well in browser but got network error when endpoint called via javascript. Works well in production
Any Idea?
This may help you:
Go to directory (from where your landing page load, if you have laravel project you need to go to public directory) to your project in command promt and fire command.
php -S <ip addresss>: <any port no>
like this
php -S 192.168.1.62:4200
Now you can access that project using 192.168.1.62:4200
You need to change your %SystemRoot%\system32\drivers\etc\hosts file. Add next line:
127.0.0.1 localserverA.local
I have seen alot alot of guides how to fox the AH01630 error and some httpd corrections and tweaks.
Surely some will be annoyed me asking for help on this specific topic but I was trying to figure out for hours how to fix my issue.
What did I do?
I have port-forwarded the required ports for Apache and MySQL
I installed WAMP on my computer
I tried to config. httpd
I read about 50 topics according to make my server public accessible
-
I tried to set up the whole thing on a fresh virtual machine
I reinstalled WAMP a few times
So what doesn't work?
The usual access refuse message: Forbidden You don't have permission to access / on this server.
-I found this in the error log: AH01630: client denied by server configuration
I have tried to fix the issue by my own and couldn't proceed further after hours, maybe I forgot a little detail or just something I have to know but I don't because I am uneducated in this specific area
Thanks in advance
Here are the logs and config, if you don't mind and know how to fix the problem send me the finished file
httpd.conf
apache_error.log http:// pastebin. com/YSZDc0tp
access.log http:// pastebin. com/xfwv5ebB
In WAMPServer 3+ there is a Virtual Host defined for localhost by default, and that is where you should make the access amendments and not in httpd.conf
So in httpd.conf replace
# onlineoffline tag - don't remove
Require all granted
</Directory>
With
# onlineoffline tag - don't remove
Require local
</Directory>
Edit \wamp\bin\apache\apache\apache2.4.18\conf\extra\httpd-vhosts.conf and replace Require local with Require all granted
EG
#
# Virtual Hosts
#
<VirtualHost *:80>
ServerAdmin webmaster#homemail.net
ServerName localhost
DocumentRoot E:/wamp/www
<Directory "E:/wamp/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I just set up my first VPS. I have a primary domain - "mysite.com". I am hosting other websites within the directory of the primary domain. So that they are organized, I have placed them in a folder called "sites".
The problem is that i am able to reach the secondary sites by going to "mysite.com/sites/othersite/index.php as well as by the secondary domain's url.
I know I need to use .htaccess to fix this. so far I have tried the following after some research:
RewriteRule ^/sites/(.*)$ http://www.othersite.com/$1 [R=301,L]
This DOES rewrite mysite.com/sites/ back to the root url, but mysite.com/sites/othersite/index.php still produces a copy of othersite.com
I am looking for a rewrite rule or set of rules that will redirect absolutely any request for anything (files, subfolders, etc) in the /sites/ directory to the root directory (mysite.com)
That's not the way to do it. You should set up virtual hosts and set the webroot to separate folders.
Create a virtual host file for each site. And write an include statement for the entire directory in your httpd config.
Example of a virtual host file:
<VirtualHost *:80>
ServerName domainname.com
DocumentRoot /var/www/vhosts/domainname.com
<Directory /var/www/vhosts/domainname.com>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
</Directory>
CustomLog /var/log/httpd/domainname.com-access.log combined
ErrorLog /var/log/httpd/domainname.com-error.log
LogLevel warn
</VirtualHost>
This will separate your error logs by domain
I have a django application and I would like to apply SSL to the admin pages. Since the admin page are the only pages needing SSL I want to do this using the apache configuration files and not using SSLMiddleware. My (partial) apache configuration files look like this:
<VirtualHost *:80>
.
.
DocumentRoot /home/www/sites_django/wmssite
.
<Directory "/home/www/sites_django/wmssite">
.
</Directory>
<Location "/admin">
RewriteEngine On
RewriteRule ^/(.*) https://www.whitemoorstudio.pvm/admin [L,R=301]
</Location>
</VirtualHost>
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile "/usr/local/etc/apache22/www_whitemoorstudio_pvm.crt"
SSLCertificateKeyFile "/usr/local/etc/apache22/www_whitemoorstudio_pvm.key"
.
.
</VirtualHost>
The TLD .pvm is a local TLD I just use for testing on my internal network.
I have set up a self-sgned certificate and it works, well.... sort of. The strange thing is that for some reason when rewriting to https it cannot find the media files in the /media directory, no images, no css, no js. The apache error log tells me it is looking in the directory /usr/local/www/apache22/data/media:
[Sat Nov 06 20:45:18 2010] [error] [client 192.168.1.134] File does not exist: /usr/local/www/apache22/data/media, referer: https://www.whitemoorstudio.pvm/admin/
When I don't rewrite to https the admin media directory /usr/local/www/apache22/media. This directory media is a logical link:
media -> /usr/local/lib/python2.5/site-packages/django/contrib/admin/media
I have no idea why without SSL it is looking in:
/usr/local/www/apache22/media
and with SSL in:
/usr/local/www/apache22/data/media
This last directory doesn't exist!!!
Anyone any idea?
Problem already solved. When adding the stuff in the VirtualHost *:443 container
I had forgotten to specify the DocumentRoot directive so it was as specified in the main httpd.conf.
It went well in the VirtualHost *:80 container because in that section I had specified DocumentRoot.
In httpd.conf it is specified as:
DocumentRoot "/usr/local/www/apache22/data"