Sponsored Content
Top Forums Web Development activecampaign rewrite rules for nginx webserver Post 302540074 by unimaxlin on Tuesday 19th of July 2011 01:19:48 PM
Old 07-19-2011
activecampaign rewrite rules for nginx webserver

Could you help me to write nginx rewite rules for activecampaign at present they only have a apache rewrite rules which to be put in .htaccess

Code:
cat .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# KB
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/kb

RewriteRule . /kb/index.php [L]

# KB DESKS WITHOUT SLASHES
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/desk/([^/]+)/kb$

RewriteRule (.*) $1/ [R=301,L]

# KB DESKS
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/desk/([^/]+)/kb

RewriteRule desk/([^/]+)/kb(.*) /kb$2 [L]


# HD DESKS WITHOUT SLASHES
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/desk/([^/]+)$

RewriteRule (.*) $1/ [R=301,L]


# HD DESKS
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/desk/([^/]+)

RewriteRule desk/([^/]+)(.*) $2 [L]


# HD
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

</IfModule>


i have tried something but it does`nt work

Code:
##1 kb
location /kb { 

if (!-f $request_filename) { 

rewrite . /index.php last;
}

if (!-d $request_filename) {

rewrite . /index.php last;

}

if ( $request_uri) {

rewrite . /index.php last;
}
}



##2 KB DESKS WITHOUT SLASHES

location /desk { 

if (!-f $request_filename) { 

rewrite (.*) $1/ permanent;
}

if (!-d $request_filename) {

rewrite (.*) $1/ permanent;

}

if ( ^/([^/]+)/kb$ $request_uri) {

rewrite (.*) $1/ permanent;
}
}



location /desk { 

if (!-f $request_filename) { 

rewrite /([^/]+)/kb(.*) /$2 last; 
}

if (!-d $request_filename) {

rewrite /([^/]+)/kb(.*) /$2 last; 

}

if ( /([^/]+)/kb $request_uri) {

rewrite /([^/]+)/kb(.*) /$2 last; 
}
}

#3 HD DESKS WITHOUT SLASHES

location /desk { 

if (!-f $request_filename) { 

rewrite (.*) $1/ last;
}

if (!-d $request_filename) {

rewrite (.*) $1/ last;

}

if ( ^/([^/]+)$ $request_uri) {

rewrite (.*) $1/ last;
}
}

#4 HD DESKS

location /desk { 

if (!-f $request_filename) { 

rewrite /([^/]+)(.*) $2 last;
}

if (!-d $request_filename) {

rewrite /([^/]+)(.*) $2 last;

}

if ( ^/([^/]+ $request_uri) {

rewrite /([^/]+)(.*) $2 last;
}
}

# 5 HD
location / { 

if (!-f $request_filename) { 

rewrite . /index.php last;
}

if (!-d $request_filename) {

rewrite . /index.php last;

}
}

Share

Last edited by pludi; 07-19-2011 at 06:55 PM..
 

8 More Discussions You Might Find Interesting

1. Web Development

Rewrite rules to change “link.html?hl=es” to “/es/link.html” etc?

Hey! Does anyone know how to create rewrite rules to change: “link.html?hl=en” to “/en/link.html” “link.html?hl=jp” to “/jp/link.html” “link.html?hl=es” to “/es/link.html” etc? Where "link.html" changes based on the page request? (2 Replies)
Discussion started by: Neo
2 Replies

2. Web Development

Apache rewrite rules.

Hi, I am new to Apache but I have requirement as follows. if the url is http://images/data1/templates/ it should redirect to http:/172.20.224.23/templates/ if the url doesn't have "data1/templates" (mean http://images/) it should redirect to http://images:8080/. I tried as below ... (3 Replies)
Discussion started by: sambadamerla
3 Replies

3. Debian

How to update Nginx in Debian to current ver?

I did a fresh install of nginx on a debian server. When I check the version of nginx, it reports 0.7.67 However, the current stable version of Nginx is 1.0.5 from what I have read. How can I update my Nginx whilst leaving my server operational? I am a relative newb, so please do... (1 Reply)
Discussion started by: bugeye
1 Replies

4. Web Development

Rewrite Rules in shell script

Hi, Looking for a shell script to redirect the below URLS... 1) http://domain.site.com/exmp/http://www.example.com/ofxm/supp/un_headfoot?un_head=yes redirects to http://domain.site.com/header.html 2) http://domain.site.com/exmp/http://www.example.com/ofxm/supp/un_headfoot?un_foot=yes... (4 Replies)
Discussion started by: Paulwintech
4 Replies

5. UNIX for Dummies Questions & Answers

How to configure NGINX?

Hi , I installed NGINX and when i i go see the browser it says welcome If you see this page, the nginx web server is successfully installed and working. Further configuration is required. is there any kind of document to configure that(i am completly new for this) (1 Reply)
Discussion started by: vikatakavi
1 Replies

6. UNIX for Dummies Questions & Answers

NGINX Setup

Here is my issue: I have two web servers hosting web services (Server A and Server B) I'd like to configure NGINX to achieve load balancing. Do I install NGINX on a third new server, or is it something that gets installed on Server A and Server B? Please share some information. ... (0 Replies)
Discussion started by: ramky79
0 Replies

7. Red Hat

Security module in nginx

hi By the command yum install nginx Want a security modules Security modules such as virtual hosts I apply Do you know a quick solution? thanks (0 Replies)
Discussion started by: mnnn
0 Replies

8. Fedora

How to wrap nginx/uwsgi around Flask?

I've SSH installed a Python 3.5 application on CentOS along with uwsgi and nginx, but after doing a sudo vi /etc/nginx/nginx.conf to edit the nginx config file as per usual, the response is currently: nginx: bind() to 0.0.0.0:80 failed (98: Address already in use) these are the contents of... (0 Replies)
Discussion started by: dev5180
0 Replies
SYSTEMD-SOCKET-PROXYD(8)				       systemd-socket-proxyd					  SYSTEMD-SOCKET-PROXYD(8)

NAME
systemd-socket-proxyd - Bidirectionally proxy local sockets to another (possibly remote) socket. SYNOPSIS
systemd-socket-proxyd [OPTIONS...] HOST:PORT systemd-socket-proxyd [OPTIONS...] UNIX-DOMAIN-SOCKET-PATH DESCRIPTION
systemd-socket-proxyd is a generic socket-activated network socket forwarder proxy daemon for IPv4, IPv6 and UNIX stream sockets. It may be used to bi-directionally forward traffic from a local listening socket to a local or remote destination socket. One use of this tool is to provide socket activation support for services that do not natively support socket activation. On behalf of the service to activate, the proxy inherits the socket from systemd, accepts each client connection, opens a connection to a configured server for each client, and then bidirectionally forwards data between the two. This utility's behavior is similar to socat(1). The main differences for systemd-socket-proxyd are support for socket activation with "Accept=false" and an event-driven design that scales better with the number of connections. OPTIONS
The following options are understood: -h, --help Print a short help text and exit. --version Print a short version string and exit. --connections-max=, -c Sets the maximum number of simultaneous connections, defaults to 256. If the limit of concurrent connections is reached further connections will be refused. EXIT STATUS
On success, 0 is returned, a non-zero failure code otherwise. EXAMPLES
Simple Example Use two services with a dependency and no namespace isolation. Example 1. proxy-to-nginx.socket [Socket] ListenStream=80 [Install] WantedBy=sockets.target Example 2. proxy-to-nginx.service [Unit] Requires=nginx.service After=nginx.service Requires=proxy-to-nginx.socket After=proxy-to-nginx.socket [Service] ExecStart=/lib/systemd/systemd-socket-proxyd /tmp/nginx.sock PrivateTmp=yes PrivateNetwork=yes Example 3. nginx.conf [...] server { listen unix:/tmp/nginx.sock; [...] Example 4. Enabling the proxy # systemctl enable --now proxy-to-nginx.socket $ curl http://localhost:80/ Namespace Example Similar as above, but runs the socket proxy and the main service in the same private namespace, assuming that nginx.service has PrivateTmp= and PrivateNetwork= set, too. Example 5. proxy-to-nginx.socket [Socket] ListenStream=80 [Install] WantedBy=sockets.target Example 6. proxy-to-nginx.service [Unit] Requires=nginx.service After=nginx.service Requires=proxy-to-nginx.socket After=proxy-to-nginx.socket JoinsNamespaceOf=nginx.service [Service] ExecStart=/lib/systemd/systemd-socket-proxyd 127.0.0.1:8080 PrivateTmp=yes PrivateNetwork=yes Example 7. nginx.conf [...] server { listen 8080; [...] Example 8. Enabling the proxy # systemctl enable --now proxy-to-nginx.socket $ curl http://localhost:80/ SEE ALSO
systemd(1), systemd.socket(5), systemd.service(5), systemctl(1), socat(1), nginx(1), curl(1) systemd 237 SYSTEMD-SOCKET-PROXYD(8)
All times are GMT -4. The time now is 06:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy