nginx: [emerg] invalid number of arguments in “return” directive


I was using a 4 year old installation of nginx (0.7) – apt-get update, apt-get install nginx claimed I had the latest version…

Turns out this error means the return directive isn’t supported in the `return 301` format until a later nginx.

Install the latest nginx by following the docs at

sudo -s
nginx=stable # use nginx=development for latest development version
add-apt-repository ppa:nginx/$nginx
apt-get update 
apt-get install nginx

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s