4 ms·
I've always used Apache but I really want to use nginx for my next project (it's a Node/express app). How should I start? It'll be running on my Ubuntu VPS. Any
by fourstar 13y ago
I've always used Apache but I really want to use nginx for my next project (it's a Node/express app). How should I start? It'll be running on my Ubuntu VPS. Any tips, suggestions, common pitfalls?
- Osiris 13y agoThe only pitfall that I've run into is converting Apache rewrite rules (htaccess) files and getting that into the nginx configuration file. For sure, the configuration file format is different, but it's not terribly complicated.
- lgbr 13y agoThere's really not that much to it. Use nginx that comes from APT and use a unix socket to communicate between node and nginx. I use this code to open a unix socket in production at tmp/socket : https://gist.github.com/lgbr/5453355 https://gist.github.com/lgbr/5453355 And use a configuration like this for nginx (replace /etc/nginx/sites-available/default with this): https://gist.github.com/lgbr/5453375 https://gist.github.com/lgbr/5453375
- mixmastamyk 13y agosudo apt-get install nginx $BROWSER http://wiki.nginx.org/Configuration $EDITOR /etc/nginx/nginx.conf man nginx man upstart sudo start nginx $BROWSER http://localhost:$PORT/
- spindritf 13y ago> sudo apt-get install nginx If you want the newest version, nginx has their own deb repository[1]. It seems to get security updates faster, too. [1] http://wiki.nginx.org/Install#Official_Debian.2FUbuntu_packages http://wiki.nginx.org/Install#Official_Debian.2FUbuntu_packa... EDIT: Not the PPA because it's "maintained by volunteers and is not distributed by nginx.org." Their repository: deb http://nginx.org/packages/ubuntu/ http://nginx.org/packages/ubuntu/ yourOScodename nginx
- mixmastamyk 13y agoI was using a ppa at one point, but reverted when the distro packaged a new enough version.
- olouv 13y agoThis was really helpful to me: https://github.com/h5bp/server-configs/tree/master/nginx https://github.com/h5bp/server-configs/tree/master/nginx