Quantcast
Viewing all articles
Browse latest Browse all 4731

Rewrite url in Haproxy

I am using Haproxy Fastcgi to serve php files for wordpress. Static files are served by Nginx. Everything is working but the wordpress permlinks are not working. Here is my Haproxy config file

global
log /dev/log local0
user haproxy
group www-data

    # Default SSL material locations

defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http

frontend myproxy
bind :80
acl url_static path_end .gif .png .jpg .css .js
use_backend static if url_static
use_backend phpservers
default_backend phpservers

backend phpservers
use-fcgi-app php-fpm
server server1 /run/php/myapp.sock proto fcgi

backend static
server server2 /var/run/nginx.sock

fcgi-app php-fpm
log-stderr global
docroot /var/www/myapp
index index.php

Now wordpress works only when the url includes index.php. Without index.php the server returns 404 error.

I want to rewrite the url from

http://example.com/index.php/hello-world/

to

http://example.me/hello-world/

In nginx we use the below config to work

location / {
                
                try_files $uri $uri/ /index.php?$args;
        }

Is their any solution like this in Haproxy

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 4731

Trending Articles