Home > apache 2.2 > Apache and Nginx - Forwarding .htaccess requests to Apache?

Apache and Nginx - Forwarding .htaccess requests to Apache?

December 3Hits:1

A really simple one but it's alluding me entirely.

I've set up nginx as a proxy for Apache and at the moment it's only set to allow requests for certain files through to Apache, the config line is below. Problem I'm having, I need it to send .htaccess through also and every change I've tried has failed! Probably someone has done this before, it's a pretty standard setup.

location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js)$ {root /var/www;} 

I would hardcode them into the nginx.conf but there's a lot of rewrites. A lot easier to let Apache handle them.

Thanks in advance!


By ".htaccess request" and "send .htaccess through" you seem to be implying that the web browser should request the .htaccess file and the web server should deliver it. This really isn't now it's supposed to work, it's so far off I'm sure I've misunderstood.

What .htaccess is actually for is for giving apache specific options based on what folder a file is in; the browser requests something from nginx, nginx passes the request to apache, apache reads the .htaccess file and runs any commands inside it, then apache reads the file that was asked for and returns that back to the user.

The latter is a standard setup, so maybe that's what you mean? If the latter is what you want, make sure that the .htaccess / apache setup is working when you access apache directly; if not, get it working there before adding nginx in front. If it is working with just apache, then check the nginx access and error logs to see what requests it is forwarding along.

Related Articles

  • Apache and Nginx - Forwarding .htaccess requests to Apache?December 3

    A really simple one but it's alluding me entirely. I've set up nginx as a proxy for Apache and at the moment it's only set to allow requests for certain files through to Apache, the config line is below. Problem I'm having, I need it to send .htacces

  • Nginx forward all requests to another domainOctober 24

    I have been struggling to get this whole setup to work. I've found bits and pieces on the net but nothing that solves all of my requirements. I need to do this to make IE8 work, so unfortunately my hands are tied a little. I can move some endpoints a

  • Apache or nginx: for 10 requests a second on a tiny server?July 20

    What would you recommend for a small server setup, maybe 10 requests a second (using php and mysql, dynamic content)? --------------Solutions------------- I'd set up nginx as a reverse proxy for Apache. Let nginx handle all the static files (images,

  • Forwarding HTTP requests to VMs behind a virtual networkJuly 28

    I'm trying to set up a virtual machine host (currently running ubuntu + KVM) which will host a number of VMs for different applications. For example, we have a wiki running on one VM and a web application running on another. Host / \ VM1 VM2 Internal

  • Nginx rewrites & passing PHP request to Apache efficientlyMarch 11

    I'm in the process of moving my rewrites off Apache and including them in Nginx instead. The code below appears to be working fine, but is this the most efficient way of doing it? Also, what if I have a large amount of rewrites - will anything slow d

  • Forwarding requests throught Apache to openVPNJanuary 21

    I am wondering if it is possible to redirect requests through Apache to eg. OpenVPN. As long as I need to bypass firewall, I need to use port 80/443 for openVPN, but there is Apache server which has both port for itself. Client ---> Firewall (allows

  • Forwarding requests in Apache if necessary based on subdomainJanuary 2

    In Apache 2.2, is there a way to forward certain subdomains to another server (in another datacenter) based on a lookup table of subdomain/IP address mappings (provided in a file or database)? The reason I need this is that I have a SaaS web app wher

  • Nginx + (Apache + Passanger) = 403 error for "/" requestMay 12

    I have the following set up: nginx as reverse proxy apache (with passenger) for serving content Now I have simple Sinatra application and the following happens if I try to access different things: domain.com/hi - Sinatra says me Hi as was coded domai

  • Forward HTTP requests to local Apache server behind router?April 1

    I have an Apache server running on Ubuntu, and by default it is using name-based virtual hosts. For some reason I have to make my local server publicly accessible, but the problem is that I am running internet with WLAN router, and my WLAN router all

  • Apache to Nginx Conversion (Newbie)December 13

    I've got a Nginx Web Server Setup with PHP and I want to move on Nginx and I want to convert these .htaccess rules to nginx.conf file: RewriteRule ^blog(|/)$ /data/core/site/blog.php RewriteRule ^blog/post(|/)$ /data/core/site/blogpost.php So far thi

  • cPanel Apache and nginx on the same server?August 28

    I'm using cPanel Apache 2 on my VPS server to host PHP / MySQL websites on port 80. So let's say we have myphp.com which just works fine. Now I installed Ruby / Rails / Passenger with nginx (also with Ruby Entreprise Edition) which runs fine on port

  • Apache or NGINX for PHP?January 5

    I've read quite a bit on the major benefits to running NGINX over Apache for serving static files. However, I have never seen an article talking about Apache vs NGINX for serving PHP pages. Question: which is faster at serving up PHP pages, Apache or

  • Nginx (for static files) and Apache (for dynamic content)?May 26

    So, my entire application runs on apache just fine. However, I want to test how much the requests per second increases if I put all static files through nginx instead. I found this thread: http://stackoverflow.com/questions/869001/how-to-serve-all-ex

  • How does Apache handle port forwarding?August 16

    I setup a localhost portforwarding configuration in the coLinux .conf file, forwarding port 8090 to port 80 in the VM. When http://localhost:8090 is entered in the browser, I get the correct response from nginx, but with Apache the response get the e

  • From Apache to Nginx: Error 310, too many redirectsFebruary 3

    I'm moving a Wordpress blog from a Apache based webserver to a Nginx based webserver. Easy steps, I thought: scp of the source WordPress folder, in this example, /var/www/example.com, which is transferred to a folder with the same name on the remote

  • apache rewrite nginx rewriteDecember 10

    I finnaly got nginx running my site are made with codeigniter and I have this old rewrite from my .htaccess #map all request urls to a specific controller method RewriteRule ^(.*)$ index.php?/welcome/domain/$1 [L] my question is how do I convert it t

  • Multisite Nginx reverse proxy routing to ApacheJanuary 2

    I'm running an Ubuntu 10.04 nginx server, with a reverse proxy to apache (to run munin monitoring). This is an excerpt of my default Apache site file: <VirtualHost *:8090> ServerAdmin [email protected] DocumentRoot /var/cache/munin/www <Directo

  • Nginx as reverse proxy for Apache and subdomain setup

    Nginx as reverse proxy for Apache and subdomain setupFebruary 5

    I have subdomain set up under Nginx and proxy passing to Apache to serve PHP files Below is my config: server { listen 80; server_name sub.domain.com.au; location ~* \.(css|js|jpg|jpeg|gif|png|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|tar|wav|bmp|rtf|sw

  • Website not working after moving from Apache to NginxDecember 28

    Hello, I moved a Magento website from an Apache + ISPconfig server to Nginx + ISPconfig (both CentOS 6.5). After doing so the website is not working properly: all pages gives 404 error, except for the home-page, on which there are many red lines all

  • How to install Nginx as Reverse Proxy for Apache on Ubuntu 15.10

    How to install Nginx as Reverse Proxy for Apache on Ubuntu 15.10June 9

    Nginx or "engine-x" is a high-performance web server with low memory usage, created by Igor Sysoev in 2002. Nginx is not just a web server, it can be used as a reverse proxy for many protocols like HTTP, HTTPS, POP3, SMTP, and IMAP and as a load

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.449 s.