I'm looking to access the parameters of a URL in the <Location> tag in Apache's httpd.conf file
The actual URL looks like this: https://website.com:1111/track?p=admin&s=875
I have the following code and 2 parameters in httpd.conf file
<Location "/tracker/track?p=&s=">
ProxyPass "http://website.com:1111/track?p=&s="
ProxyPassReverse "http://website.com:1111/track?p=&s="
Order allow,deny
Allow from all
</Location>
I'm not sure what to put in front of the = so that any value that comes in, gets passed on. Will a regex work here?
This question already has an answer here:
why wamp server put online/ offline option is missing?
(1 answer)
Closed 6 years ago.
Whatever i do, cant acces local wamp through public ip adress.
I get following error message.
Forbidden
You don't have permission to access / on this server.
Apache/2.4.23 (Win64) PHP/5.6.25 Server at (my public ip) Port 80
Below i have pasted the part of httpd.cong that should regulate this.
Basically everything seems to be fine.
Wampserver is put online using its own menu item.
I have tried inserting below code into directory settings, does not help.
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
What am i missing ?
Thank you.
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options +Indexes +FollowSymLinks +Multiviews
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Require all granted
</Directory>
#RiggsFolly- if you have read my question, you woul dknow it is nowhere near to the one you have marked it being duplicate with.
I was not asking why the menu item is not visible...
Seems if you have an already made virtual host file, the put online menu item does not issue the necessary changes to it.
In the vhosts file Changing Require local to Require all granted fixed the issue.
Strange....
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
DocumentRoot F:/wamp64/www
<Directory "F:/wamp64/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
#
I am trying to map a URL based on the filename it has to a fileshare directory.
Here is the URL that i am using
http://x.x.x.x/606547/abc.xyz.aaa/MOVIE/some.video.file-xxxxxxxx.nff?c=564378
(Where .nff is file extension).
And here is the ALiasMatch settings i have configured in default sites config file.
The apache2 is running on ubuntu.
AliasMatch ^/[.?]/(*.nff)$ /srv/samba/Assets/$1
<Directory "/srv/samba/Assets">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
#Order deny,allow
#Deny from all
#Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
I am getting forbidden error when i runt hat URL in browser. I file directory/file permissions are correct.
Can you anyone please suggest is this problem with regex or problem with configuration ?
Your expression is incorrect, using a preceding * before the dot . will not be recognized.
Try using the following:
AliasMatch /([^/]*\.nff).*$ /srv/samba/Assets/$1
Can you try this regex instead:
AliasMatch /([^./]+\.nff)$ /srv/samba/Assets/$1
I have a Django application with the following directory structure
/myapp/
/login/
/myapp_settings/
/subapp1/
/supapp2/
manage.py is in the myapp directory.
In the project's url.py I have URL settings like this:
urlpatterns = patterns('',
url(r'^subapp1/', include('subapp1.urls')),
url(r'^xhr/', include('subapp1.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^subapp2/', include('smart_selects.urls')),
# Login / logout.
url(r'^login/$', 'django.contrib.auth.views.login'),
url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page': '/subapp1/'}, name='auth_logout'),
url(r'^logout/(?P<next_page>.*)/$', 'django.contrib.auth.views.logout', name='auth_logout_next'),
)
When deployed on the development runserver, everything links and loads correctly. When I deploy the entire myapp directory to the Django root on Apache, I find it's not linking as expected.
For example, if I link to example.com/login/, I get an Apache 404. I think it's because I don't have a virtual directory configuration defined for that specific directory.
I have the following set up in Apache for my application:
WSGIScriptAlias /myapp /var/www/django-projects/myapp/myapp_settings/wsgi.py
WSGIPythonPath /var/www/django-projects/myapp
Alias /media/ /var/www/django-projects/myapp/media/
Alias /static/ /var/www/django-projects/myapp/static/
<Directory /var/www/django-projects/myapp/static>
Order deny,allow
Allow from all
</Directory>
<Directory /var/www/django-projects/myapp/media>
Order deny,allow
Allow from all
</Directory>
<Directory /var/www/django-projects/myapp/myapp_settings/>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
Do I need an Alias and a Directory configuration for each URL pattern I use? If so, how can I redo my URL patterns so that I don't need to do this. I don't want to have to do all of this extra Apache configuration when I deploy the application.
EDIT: I modified my WSGIScriptAlias as suggest by Reinbach. It now reads WSGIScriptAlias / /var/www/django-projects/myapp/myapp_settings/wsgi.py. However, this still returns a 404. The error in the Apache log says
[Fri Sep 07 09:11:00 2012] [error] [client 192.189.x.x] File does not exist: /var/www/html/login
Notice that it's looking in /var/www/html (Default Apache root) instead of /var/www/django-projects
EDIT2: I'm attaching the VirtualHost block for this section
WSGIPythonPath /var/www/django-projects/myapp
<VirtualHost sub.example.com:80>
DocumentRoot /var/www/django-projects/myapp
ServerName sub.example.com
WSGIScriptAlias / /var/www/django-projects/myapp/myapp_settings/wsgi.py
Alias /robots.txt /var/www/django-projects/myapp/static/robots.txt
Alias /favicon.ico /var/www/django-projects/myapp/static/favicon.ico
AliasMatch ^/([^/]*\.css) /var/www/django-projects/myapp/static/css/$1
AliasMatch ^/([^/]*\.js) /var/www/django-projects/myapp/static/js/$1
AliasMatch ^/([^/]*\.png) /var/www/django-projects/myapp/static/images/$1
AliasMatch ^/([^/]*\.swf) /var/www/django-projects/myapp/static/swf/$1
Alias /media/ /var/www/django-projects/myapp/media/
Alias /static/ /var/www/django-projects/myapp/static/
<Directory /var/www/django-projects/myapp/static>
Order deny,allow
Allow from all
</Directory>
<Directory /var/www/django-projects/myapp/media>
Order deny,allow
Allow from all
</Directory>
<Directory /var/www/django-projects/myapp/myapp_settings/>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
</VirtualHost>
I believe you want to change your WSGIScriptAlias as you currently have it expecting to handle example.com/myapp/login while your sample is showing you trying to use example.com/login
WSGIScriptAlias / /var/www/django-projects/myapp/myapp_settings/wsgi.py
See How to use Django with Apache and mod_wsgi
LONG STORY SHORT
Allow and Deny are deprecated since Apache 2.4.x, use Require all granted (or denied) instead.
THE LONG STORY
I'm encountering the same problem while trying to set up Django with Apache and mod_wsgi. I'm not entirely sure why this happens but when I comment out the following lines in the httpd.conf
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
#<Directory />
# AllowOverride none
# Require all denied
#</Directory>
everything works alright.
I'm not sure if this is the right and secure way to solve the problem, but I hope it might help.
P.S. I think this shouldn't cause much security troubles since root directory is aliased anyways:WSGIScriptAlias / /var/www/django-projects/myapp/myapp_settings/wsgi.py, but I may be worng.
P.P.S. Looks like the better solution would be to leave those lines uncommented, but change Order and Allow directives in favor of Require all granted. For example:
<Directory /var/www/django-projects/myapp/myapp_settings/>
<Files wsgi.py>
Require all granted
#Order deny,allow
#Allow from all
</Files>
</Directory>
However this is only a trial and error solution I could come up. I got no deep understanding why it works but Order and Allow doesn't.
P.P.P.S Oh, now I know what. Allow and Deny are deprecated since Apache 2.4.x. Good answer can be found here.
My VHOST currently looks like:
<VirtualHost *:80>
DocumentRoot /data/sites/example_deploy
ServerName deploy.example.co.uk
<Directory "/data/sites/example_deploy">
Options +SymLinksIfOwnerMatch
AllowOverride All
Order allow,deny
Allow from all
AuthUserFile /data/confs/svn/htpasswd
AuthName "Example deployment example testing"
AuthType Basic
Require valid-user
</Directory>
</VirtualHost>
We have a URL /api that takes different parameters. Examples are:
/api/testing-bot-response/1234842823
/api/sql-deploy-response/stage/172bUd7s
What we are trying to achieve is that /api/* would not require a valid user and the HTaccess is satisfied before the request is made. The URL may be made up of more than 2 parameters.
I've researched the subject and have worked out that I need to use LocationMatch and pass the Satisfy parameter, however I am not sure how the regular expression should be formed.
I've resolved this issue. The trick is to use LocationMatch. Look at the below code:
$<LocationMatch "/api/*">
order allow,deny
allow from all
Satisfy any
</LocationMatch>