Live data from Hacker News

Nginx for Developers: An Introduction

carrot.is

121–130 of 142 posts

Re: Nginx for Developers: An Introduction

#121

Earlier quoted context omitted.

Could I take your article and use it as a base for a Python version of that?

Feel free to use it. I wrote it to: A) Solidify what I had learned by putting it into writing. B) Help others avoid my dumb mistakes. So if it helps people I'm all for it. :)

My thoughts also. I'm going to start up a blog and get to it after work.

Re: Nginx for Developers: An Introduction

#122
Very nice article useful for Nginx newbies. While we are on that subject, can anyone please let me know if we can use Nginx for page cache busting purposes.

It is easy to configure Nginx to check if the cached version of the requested URL exists and serve it. But i would like to know if the configuration can be extended bit further to serve the cached file only if is less than a few days old?

Re: Nginx for Developers: An Introduction

#123
post #49

I like just keeping a single "etc/nginx/sites" folder, including "sites/*.ON" in my main nginx.conf and then appending .ON to the sites that are enabled: active.site.com.ON another.active.com.ON not.active.com

That's clever. Coming from Apache I was disappointed not to see something equivalent to: a2ensite (site)

That's a debian feature. Not an Apache feature.

Re: Nginx for Developers: An Introduction

#125
post #116

Earlier quoted context omitted.

Today You Learn that is because the original package maintainer of the NginX package in Debian (and thus later, Ubuntu) simply copied the structure of the Apache package. It's most useless because there is no script to manage the sites available like with apache . I have been complaining about this for years! On FreeBSD and all my client's sites (whether they run Linux or what), I always set mine to include sites/*.c…

It's especially bizarre given how trivial such a script is - as far as I am aware, it's a glorified symlink-maker. Hrm, looking now, a2ensite is 340 lines long...

Quite the glorified symlink maker!

It is my experience from years of administration that `ln` and `rm` (or perhaps `mv`) are the only commands necessary to work with the directories without the scripts.

Re: Nginx for Developers: An Introduction

#126
post #113

Earlier quoted context omitted.

What does visudo do that nano -w doesn't? I've never understood this properly.

Locks to only one editing user and confirms syntax is clean before saving. I'm not aware of nano enforcing correct sudoers syntax. Plus plenty of us don't like nano. man visudo for more info.

visudo, like vipasswd or crontab -e and other commands, respect the EDITOR environmental variable, so you can edit these files with whatever editor you prefer, while maintaining their protections.

Re: Nginx for Developers: An Introduction

#127
post #112

Earlier quoted context omitted.

I'm extremely biased as I have been using NginX for many years now; however, I've got to completely disagree with you. NginX's configuration is beautiful, elegant, and concise. It kicks the ever living crap out of configuring Apache or Lighttpd (the two other HTTPd's I have extensive experience with). It seems so strange, because it's different . NginX's configuration language is declarative . If is imperative and ac…

Yes, I linked to IfIsEvil. The fact that you need a page to document the horrible behavior because it's too late to fix it is a sign that something is very wrong with the config syntax.

The fact that you think it is a problem with the configuration syntax is an indication that you didn't read the wiki page, or the important part of my comment.

NginX's configuration is declarative.

The reason the imperative if was given powers beyond its means was because people clamored for the feature.

The reason it's still there is because removing it would break some working configurations that use if.

If you don't have experience with declarative programming and you think in terms of imperative programming, it might seem "horrible behavior", but actually, it's what is to be expected from mixing the two paradigms in the way it is being mixed.

The real wart is under the hood where-in location based if's are converted to sub-locations. This is where many problems related to IfIsEvil stem from.

Re: Nginx for Developers: An Introduction

#129

If you like this article, I wrote a similar one called Devops for Dummies. http://tech.pro/tutorial/1335/devops-for-dummies-vps-configu... It teaches you how to setup a DigitalOcean (or any other) VPS from scratch to host N amount of Rails applications using Nginx and Passenger. It took me some time to get things working properly and I distilled it into this short article that holds your hand and takes you from A to…

Awesome! If you like to go a bit further I suggest learning Chef in order to automate this kind of tasks. I wrote a tutorial about it: http://matteodepalo.github.io/blog/2013/03/07/how-i-migrated...

Re: Nginx for Developers: An Introduction

#130
post #113

Earlier quoted context omitted.

Locks to only one editing user and confirms syntax is clean before saving. I'm not aware of nano enforcing correct sudoers syntax. Plus plenty of us don't like nano. man visudo for more info.

visudo, like vipasswd or crontab -e and other commands, respect the EDITOR environmental variable, so you can edit these files with whatever editor you prefer, while maintaining their protections.

True. Provisioning a new test VM for me usually entails something like this: ssh in; visudo; wtf, this is nano! Boo!; ctrl-x; update-alternatives --config editor... :)
Post reply on HN