Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Fri Dec 01, 2023 1:50 am


This forum is dedicated to Apache, Nginx, Lighttpd, Squid and other HTTP transport protocol related software

Author Message
debuser
Post  Post subject: Starting nginx: [emerg]: directive "rewrite" is not terminated by ";"  |  Posted: Tue Feb 23, 2010 6:05 am

Joined: Thu Aug 06, 2009 2:48 am
Posts: 105

Offline
 

Starting nginx: [emerg]: directive "rewrite" is not terminated by ";"

Code:
Starting nginx: [emerg]: directive "rewrite" is not terminated by ";" in /usr/local/nginx/vhosts/www.site.com.conf:45


Even though the Nginx configuration file contains a rewrite rule which is terminated corectly (with
Code:
last;
), if a rule contains curly brackets {}, then those brackets finish the location directive in Nginx configuration prematurely, thus making Nginx complaining about line termination.

Example:
Code:
system {
                   listen  80;
...
                    location / {
...                                 
                                      rewrite ^/[a-z0-9_-]*-[a-z]{1}([0-9]+)(/(news)+)?(/(digest)+)?(/(short|long)+)?/([a-z0-9_]+)\.xml(\.gz)?$ /gymrss.php?$8=$1&$3&$5&$7&gzip=$9 last;
...                                 
                    }                                     
}

[hence the curly brackets in [a-z]{1}([0-9]+) ].

To avoid these situations, enclose the first part of the regular expression with double quotes like below:
Code:
rewrite "^/[a-z0-9_-]*-[a-z]{1}([0-9]+)(/(news)+)?(/(digest)+)?(/(short|long)+)?/([a-z0-9_]+)\.xml(\.gz)?$" /gymrss.php?$8=$1&$3&$5&$7&gzip=$9 last;





Top
Display posts from previous:  Sort by  
E-mail friendPrint view

Topics related to - "Starting nginx: [emerg]: directive "rewrite" is not terminated by ";""
 Topics   Author   Replies   Views   Last post 
There are no new unread posts for this topic. Apache - Restricting "Server" information in HTTP response header with ServerTokens

debuser

0

2336

Thu Nov 10, 2011 6:39 am

debuser View the latest post

There are no new unread posts for this topic. Remove "X-Powered-By: PHP/5.2.11" from HTTP headers of your web server

debuser

0

5295

Wed Mar 24, 2010 6:49 am

debuser View the latest post

There are no new unread posts for this topic. Phpbb 3.0.5 "Log me on automatically" cookies and sessions problem

debuser

3

10035

Wed May 19, 2010 3:08 am

admin View the latest post

There are no new unread posts for this topic. NGINX: how to set the default virtual host

mandrei99

0

3985

Thu Dec 12, 2013 6:01 am

mandrei99 View the latest post

There are no new unread posts for this topic. Nginx: How to list virtual hosts

mandrei99

0

13330

Mon Feb 23, 2015 5:05 pm

mandrei99 View the latest post

There are no new unread posts for this topic. NGINX: 413 Request Entity Too Large

admin

0

2032

Thu Sep 14, 2017 4:48 am

admin View the latest post

There are no new unread posts for this topic. Attachment(s) Nginx + apache (for PHP) with real IP addresses in logs

designeru

0

3091

Tue May 18, 2010 9:49 am

designeru View the latest post

There are no new unread posts for this topic. Nginx + php-fpm increase upload_max_filesize and other php values per vhost

mandrei99

0

8226

Mon Jan 02, 2012 9:04 am

mandrei99 View the latest post

There are no new unread posts for this topic. NGINX: How to redirect http to https website

mandrei99

0

3903

Mon Feb 09, 2015 3:27 pm

mandrei99 View the latest post

There are no new unread posts for this topic. Converting PhpBB-SEO Apache RewriteRule to Nginx rewrite

debuser

0

10583

Tue Feb 23, 2010 5:00 am

debuser View the latest post

 

Who is online
Users browsing this forum: No registered users and 0 guests
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
News News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO