apache-config

Django with mod_wsgi returns 403 error

六眼飞鱼酱① 提交于 2019-12-18 08:54:39
问题 I am trying to use Django with Apache (and mod_wsgi). With the default Django webserver everything was going well, but now I get 403 (access forbidden) error when trying to load the page. I searched previous posts here and read official docs but the solutions there weren't helpful. Here are the lines from my httpd.conf: WSGIScriptAlias / /home/karlis/django/apache/django.wsgi <Directory /home/karlis/django/apache> Order allow,deny Allow from all </Directory> Alias /media/ /home/karlis/django

Django (wsgi) and Wordpress coexisting in Apache virtualhost

时光总嘲笑我的痴心妄想 提交于 2019-12-17 10:56:57
问题 I have a Django project that I need mounted at two different subdirectories of my url, and I need Wordpress running at /. So: *.example.com - WordPress *.example.com/studio - django *.example.com/accounts - django Here's the httpd.conf that I have so far: <VirtualHost *:80> ServerName wildcard.localhost ServerAlias *.localhost AddType application/x-httpd-php .php DocumentRoot /var/empty Alias /site_media/ /home/zach/projects/python/myproject/static/ Alias /media/ /home/zach/projects/python

Configure apache to listen on port other than 80

我只是一个虾纸丫 提交于 2019-12-17 03:22:54
问题 I use centOS server. I want to configure apache to listen on port 8079. I added LISTEN 8079 directive in httpd.conf . I opened port 8079 in iptables and restarted iptables. I even stopped iptables service. "netstat -nal | grep 8079" shows "tcp 0 0 :::8079 :::* LISTEN" If I try to access http://localhost:8079 or http://myserver.com:8079 from that machine, I can access that page. BUT from any other machine I am not able to access the site on any port other than 80. On port 80, it works. On port

.htaccess not working apache

时间秒杀一切 提交于 2019-12-17 02:43:18
问题 I have a server from AWS EC2 service running on Linux ubuntu and I have installed apache, php, and mysql. I have added a .htaccess file in my document root /var/www/html . I entered this code in it: ErrorDocument 404 /var/www/html/404.php and it is still not showing up. I kept entered this command multiple times: sudo service httpd restart to restart the server but no changes displayed... How can I fix this... Did I do something wrong? Thanks in advance! 回答1: First, note that restarting httpd

.htaccess not working apache

情到浓时终转凉″ 提交于 2019-12-17 02:43:09
问题 I have a server from AWS EC2 service running on Linux ubuntu and I have installed apache, php, and mysql. I have added a .htaccess file in my document root /var/www/html . I entered this code in it: ErrorDocument 404 /var/www/html/404.php and it is still not showing up. I kept entered this command multiple times: sudo service httpd restart to restart the server but no changes displayed... How can I fix this... Did I do something wrong? Thanks in advance! 回答1: First, note that restarting httpd

Can I turn off an Apache Directive then turn it on in an include?

泄露秘密 提交于 2019-12-13 07:30:15
问题 I have a VirtualHost block that includes common configuration items, one directive is ProxyPreserveHost. Can I "procedurally" turn off ProxyPreserveHost for a Rewrite directive then have the include turn it back on? For example: <VirtualHost *:80> ServerName www.blah.com ... ... ProxyPreserveHost off RewriteRule /somepath http://otherhost/otherpath [P] Include /path/to/file/turning-on-ProxyPreserveHost </VirtualHost> The otherhost is on a CDN and preserving the host is creating some name

How can I redirect all sub-directories to root using htaccess or httpd.conf?

好久不见. 提交于 2019-12-12 09:44:16
问题 I have an index file that builds content based on n PATH_INFO variables. Example: site.com/A/B/n/ should use index.php at either: site.com/index.php?var1=A&var2=B&varN=n - or - site.com/index.php/A/B/n/ instead of: site.com/A/B/n/index.php || which doesn't exist || So far I've tried a number of variations of: RedirectMatch ^/.+/.*$ / with no success. I have an inelegant and unscalable solution here: RewriteEngine On RewriteRule ^([a-zA-Z0-9_-]+)/?$ index.php?p1=$1 [NC,L] RewriteRule ^([a-zA

How can I 301 redirect multiple leading slashes (///file.txt) to just (/file.txt)?

早过忘川 提交于 2019-12-11 10:32:01
问题 I have my apache conf set to show php generated text on a .txt file like so: Alias /file.txt /var/www/domain.com/html/file.php The problem is that this now works for any number of leading slashes. For example, all of the following work: domain.com/file.txt domain.com//file.txt domain.com///file.txt But I'd like all multiple slashes to redirect to the root: domain.com//file.txt =====[301]=====> domain.com/file.txt This normally wouldn't be an issue except one of these multiple slashes URLs was

mod_rewrite with subdomain and url pattern

坚强是说给别人听的谎言 提交于 2019-12-10 18:15:34
问题 I want to use the subdomain as a get variable with mod_rewrite AND use some parameter : eg /page/language/site/counter -> index.php?o=operator&lg=language&s=arg1&c=arg2 How to do that with mod_rewrite? RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] RewriteCond %{HTTP_HOST} ^([a-zA-Z]{3,6})\.example\.com RewriteRule ^index/([a-z]{2})/([0-9]{1,2})/([0-9]{1,2})$ http://www.example.com/index.php?o=%1&lg=%2&site=%3&counter=%4 [NC,L] # for index.php RewriteRule ^export/([a-z]{2}

Property file not reflecting the modified changes using Apache Commons Configuration

末鹿安然 提交于 2019-12-10 11:42:28
问题 I am trying to explore Apache commons configuration to dynamically load the property file and do modification in the file and save it. I wrote a demo code for the same. Code Snippet package ABC; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; public class Prop { public static void main(String[] args) { try { URL propertiesURL = Prop