English (change)
Now to add sites & blogs to our powerful web server, using vhost (virtual host) files and symlinks. We’ll create a site file structure, add users with groups & permissions, tweak Nginx with FastCGI support and upload pages using SFTP.
OK, so we’ve got Nginx humming on our shiny new Linux server, within our spanky new VPS. By the end of this how-to post, we’ll have some sites resolving.
Essentially, we’re going to create a multi-site & blog document tree, on which to hang our webs. Then we’re going to use a simple copy/paste/fill-the-blanks procedure to add more sites whenever we want. In fact, if you fancy setting up your own web host co-op, by the end of this guide you’ll be able to start signing up the neighbours.
[sniplet guvSellBox]
[sniplet vpsIndexSell]
[sniplet video]
Two notes:-
Let’s add the web directory, in which all your webs will reside:-
[text]sudo mkdir /home/public_html[/text]
And, in there, add a standard set of four folders, per domain. I’ll add folders for 2 domains, ‘waywiderweb’ and ‘waywiserweb’. Add as many as you like:-
[text]sudo mkdir -p /home/public_html/waywiderweb.com/{public,private,log,backup}[/text]
[text]sudo mkdir -p /home/public_html/waywiserweb.com/{public,private,log,backup}[/text]
Setup users & groups with appropriate ownership permissions:-
[text]
sudo -i
addgroup webmasters
usermod -G webmasters guvnr
[/text]
.. which basically means we’ve assumed SuperUser permissions, added a group & modified the user ‘guvnr’ to add to the new group.
Optionally, add more users, giving them ‘webmasters’ group permissions. You’ll have to add them first. Mine are Jack and Jill:-
[text]
adduser jack
usermod -G webmasters jack
adduser jill
usermod -G webmasters jill
[/text]
Edit the web directory ownership. In my case, I want user ‘guvnr’ & group ‘webmasters’ to own that:-
[text]
chown -R guvnr:webmasters /home/public_html
chmod -R g+w /home/public_html
[/text]
Looking ahead, we set the group id to ‘webmasters’ for newly-created files & folders:-
[text]find /home/public_html -type d -exec chmod g+s {} ;[/text]
And logout of ‘root’ account (which takes you back to your user account in the CLI):-
[text]exit[/text]
Create a homepage for the first new domain:-
[text]sudo nano /home/public_html/waywiderweb.com/public/index.html[/text]
…pasting some content within:-
[text]
[/text]
…CTRL-X to quit, press ‘y’ to save & hit return.
Optionally, repeat for subsequent domains.
You have one of each per domain.
The symlink, or symbolic link, references the web server to the virtual host file.
The vhost file is a configuration file. It tells the web server, for example, things like where the web files live or the kind of URI structure you want.
As we did for the default settings in Part 11: Nginx (better than Apache) Web Server, we’ll create a vhost file & a symlink for each domain. First the vhost:-
[text]sudo nano /usr/local/nginx/sites-available/waywiderweb.com[/text]
…paste this within:-
[text]
server {
listen 80;
server_name www.waywiderweb.com;
rewrite ^/(.*) http://waywiderweb.com/$1 permanent;
}
server {
listen 80;
server_name waywiderweb.com;
access_log /home/public_html/waywiderweb.com/log/access.log;
error_log /home/public_html/waywiderweb.com/log/error.log;
location / {
root /home/public_html/waywiderweb.com/public/;
index index.php index.html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ .php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /usr/local/nginx/conf/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /home/public_html/waywiderweb.com/public/$fastcgi_script_name;
}
}
[/text]
With that, your URI will appear as http://waywiderweb.com. If you prefer the format http://www.waywiderweb.com, scrap the above and paste this instead:-
[text]
server {
listen 80;
server_name waywiderweb.com;
rewrite ^/(.*) http://www.waywiderweb.com/$1 permanent;
}
server {
listen 80;
server_name www.waywiderweb.com;
access_log /home/public_html/waywiderweb.com/log/access.log;
error_log /home/public_html/waywiderweb.com/log/error.log;
location / {
root /home/public_html/waywiderweb.com/public/;
index index.php index.html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ .php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /usr/local/nginx/conf/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /home/public_html/waywiderweb.com/public/$fastcgi_script_name;
}
}
[/text]
Repeat that virtual host file creation, pasting the code within, for any more domains.
Now, for all domains, add the symlink:-
[text]sudo ln -s /usr/local/nginx/sites-available/waywiderweb.com /usr/local/nginx/sites-enabled/waywiderweb.com[/text]
This will make Nginx run with PHP on reboot. Thanks to Stoyan for this solution, and to Gleb, for a handy chunk of code.
We need to install the library:-
[text]sudo aptitude -y install libfcgi0ldbl[/text]
Create a file:-
[text]
sudo nano /etc/default/php-fastcgi
[/text]
…and paste the configuration settings:-
[text]
#
# Settings for php-cgi in external FASTCGI Mode
#
# Should php-fastcgi run automatically on startup? (default: no)
START=yes
# Which user runs PHP? (default: www-data)
EXEC_AS_USER=www-data
# Host and TCP port for FASTCGI-Listener (default: localhost:9000)
FCGI_HOST=localhost
FCGI_PORT=9000
# Environment variables, which are processed by PHP
PHP_FCGI_CHILDREN=5
PHP_FCGI_MAX_REQUESTS=1000
[/text]
Now to make FastCGI start on demand. We’ll create another file:-
[text]
sudo nano /etc/init.d/php-fastcgi
[/text]
…and paste this lot within:-
[text]
#!/bin/sh
### BEGIN INIT INFO
# Provides: php-fastcgi
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop php-cgi in external FASTCGI mode
# Description: Start and stop php-cgi in external FASTCGI mode
### END INIT INFO
# Author: Kurt Zankl
# Do NOT “set -e”
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC=”php-cgi in external FASTCGI mode”
NAME=php-fastcgi
DAEMON=/usr/bin/php-cgi
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
#. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
# If the daemon is not enabled, give the user a warning and then exit,
# unless we are stopping the daemon
if [ "$START" != "yes" -a "$1" != "stop" ]; then
log_warning_msg “To enable $NAME, edit /etc/default/$NAME and set START=yes”
exit 0
fi
# Process configuration
export PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS
DAEMON_ARGS=”-q -b $FCGI_HOST:$FCGI_PORT”
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon –start –quiet –pidfile $PIDFILE –exec $DAEMON –test > /dev/null
|| return 1
start-stop-daemon –start –quiet –pidfile $PIDFILE –exec $DAEMON
–background –make-pidfile –chuid $EXEC_AS_USER –startas $DAEMON —
$DAEMON_ARGS
|| return 2
}
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon –stop –quiet –retry=TERM/30/KILL/5 –pidfile $PIDFILE > /dev/null # –name $DAEMON
RETVAL=”$?”
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
start-stop-daemon –stop –quiet –oknodo –retry=0/30/KILL/5 –exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don’t delete their pidfiles when they exit.
rm -f $PIDFILE
return “$RETVAL”
}
case “$1″ in
start)
[ "$VERBOSE" != no ] && log_daemon_msg “Starting $DESC” “$NAME”
do_start
case “$?” in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg “Stopping $DESC” “$NAME”
do_stop
case “$?” in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
restart|force-reload)
log_daemon_msg “Restarting $DESC” “$NAME”
do_stop
case “$?” in
0|1)
do_start
case “$?” in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo “Usage: $SCRIPTNAME {start|stop|restart|force-reload}” >&2
exit 3
;;
esac
:
[/text]
That script needs permission to initiate on reboot and some startup hooks:-
[text]
sudo chmod +x /etc/init.d/php-fastcgi
sudo /usr/sbin/update-rc.d -f php-fastcgi defaults
[/text]
Now boot it with this:-
[text]sudo /etc/init.d/php-fastcgi start[/text]
And restart Nginx:-
[text]n2r[/text]
…or if that doesn’t work (you didn’t follow Part 7: Edit bashrc for User-Friendly Linux, huh?), use…
[text]sudo /etc/init.d/nginx restart[/text]
Check your site in a web browser. Then, reboot Linux:-
[text]sudo reboot[/text]
And check again.
Refer to Part 12: Setup FileZilla for Secure FTP (SFTP) for how to set up a popular Secure FTP client (with SSH tunnelling for data encryption.)
Within the document structure we set up above, the web files for each site sit in the ‘public’ folder. To be clear, log into an FTP client and head to your equivalent to:-
[text]
/home/public_html/waywiderweb.com/public/ # here’s a website root folder
/home/public_html/waywiserweb.com/public/ # here’s another website root folder
[/text]
You guessed it. You can upload your site & blog files in there, binning the test homepages we created above.
If you want WordPress, we’ll fine-tune our system for that in Part 14: Set up WordPress on Nginx with Pretty URLs & WP Super Cache. Not only does it perform well, with happy links, but using Subversion makes for a super-swift platform/plugin install, with hyper-fast updates for both thereafter.
OK, tea-time.
I’ll wrap up the series with posts about adding a control panel, configuring Google Apps for your domain-specific email, and the moving day POA. Then you can kiss that shared host goodbye!
Missed something? Here’s the series index…
[sniplet vpsIndex]
Install/Upgrade WORDPRESS with SUBVERSION - VPS Bible #15 - GUVNR June 4th, 2009 at 9:50 am
[...] Part 13: * Serve Multiple Sites & Blogs with Virtual Hosts [...]
Chris Foster June 9th, 2009 at 9:10 am
I’m just setting up on Mosso “Cloud Server” and I’m using your guide up to the point of VPS Bible Pt 13 with no linux ability whatsoever. I had previously started working with a Fedora 10 install, but when I came across your Bible, I deleted that server and started again.
I created backups after each stage: Ubuntu (hardened), ubuntu + mysql + php and completed up to Pt 13 :Looking ahead, we set the group id to ‘webmasters’ for newly-created files & folders:-
But then I forgot to “Exit” from the root account and instead closed down the putty session.
I tried to go back in with both the root and secondary account but am greeted with ‘Network error: Connection timed out’
Apparently this may due to “due to a repeat key exchange in SSH-2″ or “due to keepalives” in which case it may come up again after an hour.
I did try both a warm and cold boot, but to no avail..so I’ll have to wait it out at this stage.
Would you be able to suggest a course of action to rectify if it doesn’t back up or a possible setting change to avoid again if doing the stupid crash the putty session trick? It must be quite important to exit the account session in putty, so I guess highlighting the EXIT command in the Bible may help others avoid this mistake.
If it doesn’t come back up in a couple of hours, I’ll reinstate from the last backup and start the MySQL/PHP sections again.
This is an awesome resource
Cheers,
Chris
the_guv June 9th, 2009 at 10:47 am
cheers Chris – appreciate that.
Have added an explanatory note, in case anyone decides to type ‘exit’ twice or, as you did, closes the CLI with the X button.
Hey … it’s bad practise to use the X button to close the CLI. Use ‘exit’ or ‘logout’ instead.
I’m not sure why you can’t get back in. Are you sure your authentication keys were working before Part 13? Possibly your VPS provider has a CLI function built into your VPS Manager/Control Panel? With Linode and Slicehost, for example, there is such a module (Linode call it ‘Lish’) meaning you can reaccess the server from a terminal, then retrace and correct any mistakes, and then regain access thereafter with your regular PuTTY CLI.
Hope that helps.
Shane July 2nd, 2009 at 8:26 pm
Add Users, Groups and Permissions:
In the second to last step, ‘Looking ahead, we set the group id to ‘webmasters’ for newly-created files & folders:-’, if you get:
find: missing arguement to ‘-exec’
just add a backslash before the closing semicolon, eg:
find /home/public_html -type d -exec chmod g+s {} ;
Samuel July 6th, 2009 at 5:31 pm
Would be nice to see a new chapter of “how to setup multi-site with multi-user+disk quotes”
By the way… again I found problems with a file. This time ‘php-fastcgi’ file. But I have solved it using Google and replacing only one function.
I have realize that at do_start function some ” characters was missing, making the script to fail. I think this is the same problem I have with the bash prompt customization.
It seems like you lost all ” characters in the code when posting.
the_guv July 7th, 2009 at 12:48 am
@Shane – tx for that.
@Samuel – my bad, but surely your typo! unless anyone else has had this problem? not reported so far …..
Samuel July 7th, 2009 at 12:29 pm
@the_guv: I’m sure that is not my typo, but yours
The common for all my problems are the missed ” characters of your snippets. Maybe this is due to WordPress filtering (or plugin related if you used one to publish the snippets).
You can do this check:
Go to part 7 and check the snippet line for formating the CLI prompt:
export PS1=”[e[32;1m]u[e[0m][e[32m]@h[e[36m]w [e[33m]$ [e[0m]”
And now check that same line in the video (minute 3, 52 seconds). You’ll see that in the video that line have a lot of ” characters.
Without ” characters that line simply is not working.
And this is the same for many other snippets.
the_guv July 8th, 2009 at 12:44 am
apologies Samuel .. was a few scripts worth of typo, as it ‘appened .. was a newly-installed plugin interfering with the syntax highlighter. sorted now. thank you for tip-off.
Jason July 13th, 2009 at 11:27 pm
adding myself to webmasters made me remove myself from sudoers.
the_guv July 14th, 2009 at 12:46 am
@Jason .. like i said in earlier reply/previous post .. sounds like a permissions error, just moreso. i’d retrace those steps with a fine toothcomb. any more detail, like what deviations you’ve made from the series, and maybe i or others can help more. truth is, probably quicker to start over but not stray from the path. best of luck.
MichaellaS July 22nd, 2009 at 12:33 am
tks for the effort you put in here I appreciate it!
the_guv July 25th, 2009 at 11:29 am
@MichaellaS .. thank you, good to hear.
mary-aloe August 1st, 2009 at 4:12 pm
Thanks
trav 19 August 11th, 2009 at 12:08 am
Hi Guv, here I am again
Sorry for my prev. comment about “spawn-fcgi”, I really don’t know what I’m talking about for the most part (disclaimer), so only NOW I realized we didn’t do it because of this Part 13. Now I get that both have the same purpose, so I’ve deleted my spawn-fcgi to follow this above guide.
The problem is I keep getting 502 BAD GATEWAY messages, so then I checked the file above, /etc/init.d/php-fastcgi,
and if you look at line# 19:
DAEMON=/usr/bin/php-cgi
I have a file named “php5-cgi” not php-cgi, so I changed that.
BUT THAT DIDN’T SOLVE THE PROBLEM
Which other files should I check? What did I do wrong? I set the ownership of php-fastcgi to mine:(
the_guv August 23rd, 2009 at 9:26 am
Hey Trav .. Maybe you guessed, I was on holiday!
So what’s the deal .. you sorted that?
// To avoid any confusion with other folks, this is a WordPress MU issue, not specific to this tutorial or the VPS Bible. At some stage I’ll be adding a tutorial about setting up MU with or without BuddyPress.
Blofo August 27th, 2009 at 8:07 pm
Hey guv, Keep up the good work!
juanco September 2nd, 2009 at 6:49 pm
in the guvs words .. much appreciated
en serio, total util
Bill Bartmann September 2nd, 2009 at 8:25 pm
This site rocks!
Dave September 12th, 2009 at 4:48 am
Hmm so I figured out the email thing. Now I am having this problem.
When I get to the step to restart nginx with n2r, I get this:
Stopping nginx: Starting nginx: 2009/09/11 22:24:27 [warn] 4637#0: the “user” directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/nginx/conf/nginx.conf:1
2009/09/11 22:24:27 [emerg] 4637#0: could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32
Dave September 12th, 2009 at 2:55 pm
Heh, I am always hasty to post for help. I figured out that problem as well. I kept changing the server_names_hash_bucket_size in the nginx.conf in my users folder and not on the actual server.
And for the other thing, I fixed that too but it is kind of hard to explain how I did lol.
Agus September 16th, 2009 at 11:04 am
Hi Guv,
Fastcgi keeeps failing on my site, say every few day, especially when the site gets very busy… in this situation, it will give me the 502 bad gateway page…
What do i do now? It’s crazy to think I have to reboot or restart every couple day…
Please help… I am really hoping I will get your help… you have been sooooooo busy lately…
Thanks,
Agus
the_guv September 16th, 2009 at 8:18 pm
@Blofo, @juanco & @Bill .. kindly cheers
@Dave .. sorry been on hols/generally lazy-like/beaching it and gorging on ravioli .. pleased you’re sorted tho.
@Agus .. er, I see you’re up for now and I just got my daily footie fix as a result, in some ridiculous language or other
Frustratin tho’, I’m sure. Tell me, did you follow the fastCGI stage of the tut, as is, or did you veer off a bit? any diversion at all from the Bible? cos I dunny understand what’s up there, off hand, I’m sorry to say. of course, I’m still in holiday mode and can barely even spell PHP today. if I don’t come straight back to you, you can always catch me down the pub with the third beer on the right
Who’s your host? Probably worth asking them too, could be something there.
Yendis September 18th, 2009 at 12:59 am
Firstly thanks for this Bible Guv. I’m learning loads.
I want to create a copy of a site I want to move to a VPS from a shared server and would like to have the copy working before I actually ‘move’.
I’ve followed this guide (I see the nginx welcome page) and I’ve uploaded files.
I remember with the shared server there was a ‘temporary url’ something like http://XXX.XX.XXX.XX/~account_name which you would use until the nameservers for the domain was changed.
My guess is that I would need to do something different in this part (13) and perhaps 10 but thats just a guess.
I’m on Linode with pretty much an identical set up as the guide. Please advise.
the_guv September 18th, 2009 at 6:56 am
@Yendis .. Tx to you, real nice to hear, Sir.
If I get you right, all you wanna do is to test an as-live setup, before flicking the switch?
.. presuming the site’s been config’d for nginx, you’ve n2r’d, the files are uploaded, (db connected) and the dns has been setup ..
.. and before editing nameservers at your site registrar ..
.. just edit your hosts file, locally, to point your pc to resolve the domain to your remote/VPS’ IP.
It’s, er, all covered in non-geeky-greek, right here ..
Moving Day! How to Move Your Blog or Site
Lemme know if somat missing, hope that helps tho’.
PS Linode rocks, huh?
George Smith September 18th, 2009 at 11:05 am
Hi, thanks so much for putting this guide together.
Towards the end of the tutorial, when I run the n2r command to restart nginx, I’m seeing an error message:
“could not open error log file: open() “/usr/local/nginx/logs/error.log” failed (13: Permission denied)
2009/09/18 04:58:33 [warn] 2423#0: the “user” directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/nginx/conf/nginx/conf:1
2009/09/18 04:58:33 [emerg] 2423#0 open() “/usr/local/nginx/logs/access.log” failed (13: Permission denied)
Although everything before and after this seems to work normally. Should I be concerned?
the_guv September 18th, 2009 at 6:48 pm
@George .. try these:-
sudo /etc/init.d/nginx stop
sudo /etc/init.d/nginx start
sudo /etc/init.d/nginx restart
Do you get errors now?
George Smith September 18th, 2009 at 10:25 pm
@the_guv No, no errors at all with those. I am getting a few perculiar issues though that I wasn’t having before – for example, when attempting to open bashrc, I’m seeing:
Error reading /home/george/.nano_history: Permission denied
Which definitely wasn’t happening before. I don’t know whether the problems are related.
George Smith September 18th, 2009 at 11:00 pm
Ah, I just found out why I was getting an error with nano. Apparently ‘sudo nano’ creates a .nano_history file in the user’s home directory which nano can’t read when called from the user account (detailed here: http://ubuntuforums.org/showthread.php?t=204307).
Zereshk September 19th, 2009 at 9:06 am
Dude, your tutorials are like a breeze of fresh air, especially after wasting hours and hours with those geeky ones. Thank you sudo much!
Just 2 wee thing:
1) My ubuntu 9.04 des not allow aptitude so I needed to replace it with apt-get
2) apparently libfcgi0 is obsoletes and ubuntu suggests to installed libfcgi0ldbl instead.
All in all, you saved days of my life. Thanks again.
Agus September 23rd, 2009 at 3:52 am
Hey Guv,
I have a question. Why is it that when I add a new site, it will sometime go to my other site, like its automatically redirected there.
Do I have to do the steps exactly as directed here every time I add a new site? I know I skipped steps like the chmod, add user, things I know I have already done the first time I used this tutorial.
I am now trying to install magento with nginx… any experience?
also Guv, in your opinion, if I were to build a complete soccer site (like soccernet.com), would it be wise to continue with Drupal (i like it, and i know developers like it too…), or build from scratch?
Thank you Mr. Governor…
the_guv September 23rd, 2009 at 9:55 am
@George .. OK, pleased that’s sorted. BTW, I was getting those nano errors too! That post sorted me as well, thank you.
Re. your earlier problem, do you still get that? I am guessing that’s something to do with your bashrc n2r alias .. maybe the command could be changed .. you got what I advise above, to the letter? Er, I’m fishing .. I’ve had this error before too, but can’t remember exactly why off-hand.
@Zereshk .. m8, that is just such a top ting to hear.
if for some reason your ubuntu version doesn’t have aptitude installed, i would strongly advise you to install it, basically because aptitude is a far superior installer to any other.
sudo apt-get install aptitude
.. will install it and, thereafter, very rarely would you use apt-get if at all. (basically because aptitude remembers your installation history so when you remove stuff it’s more efficient with the task .. er, I’ve written about it but it’s buried in a long post so I’ll knock out a specific one about this, it’s worth it.)
“apparently libfcgi0 is obsoletes and ubuntu suggests to installed libfcgi0ldbl instead.”
.. really? I installed Nginx t’other day without noticing this issue, but very possible indeed so thank you .. likely others will be grateful for that clarification.
@Agus .. to add further sites, read this ..
Add Web Sites Nginx Cheatsheet
Magento .. no experience but I reckon that looks very simple to set up.
.. but hey, you let me know please.
Drupal .. yeah, well, it’s popular. So’s McDonalds. (I’m being a bit unfair.) You ever looked at MODx?
.. MODx knocks any other cms system into a cocked hat. Basically, it allows you to take your clients’ functionality wishlist and his grafix’ layered .psd and not compromise with anything. Drupal is easier to get to grips with, sure.
Thank you Mr Agus
the_guv September 24th, 2009 at 1:57 pm
IMPORTANT NGINX UPGRADE ANNOUNCEMENT
@Zereshk .. er, in a fit of memory today I realised why you had had that obsolete file error ..
@everyone ..
.. it was because bozo-here upgraded the Bible last week to reflect the latest Nginx stable release and then forgot to mention that it had this newly-required fastCGI shared library file, libfcgi0ldbl, replacing the outdated library libfcgi0.
Apologies all, I promise, I have tested the entire procedure with the Nginx’s latest greatest stable release and all works well, so I’ve updated the instructions above to allow for the new library.
This error won’t occur now.
Future note: As Nginx or other key application stable releases are upgraded, I’ll be amending the Bible accordingly, the changes tested each time. Also, for the record, and as has been rightly requested by one or two folks, I’ll be adding a How to Upgrade Nginx Safely guide in the VPS Admin section, pretty shortly, so watch for that.
Right .. back to work .. onwards and upwards, all that.
(@Zereshk .. tx for the tip, Sir.)
Nginx Error & Access Logs - VPS ADMIN #9 - GUVNR November 30th, 2009 at 9:09 pm
[...] who followed Serve Multiple Sites & Blogs with Virtual Hosts mapped out the location of the logs in each site or blogs virtual host file or, if you bundled each [...]
Dimitris December 1st, 2009 at 1:43 am
addgroup webmasters
-bash: addgroup: command not found on centos
the_guv December 7th, 2009 at 9:58 am
@Dimitris .. sure, this guide is for Debian Linux, using Ubuntu 8.04 LTS (Long Term Support)
Omid December 31st, 2009 at 10:12 pm
Hi, first off, thanks for the excellent tutorials. I faithfully followed the steps for nginx/0.7.64 and could get to the Damn, Guvnr
point. but when I upload a real site to the default site, I get 502 bad Gateway error. Your help is much appreciated.
the_guv January 9th, 2010 at 7:01 pm
Hi Omid .. that’s likely a typo in the relevant virtual host file. By all means post that up if not sorted now and I’ll take a look.
ADD Nginx Sub-Domains (or WordPress Blogs) - VPS ADMIN #2 - GUVNR January 14th, 2010 at 1:25 pm
[...] is very similar to adding a domain, which is detailed here and cheat-sheeted here, but not quite the same, so I've cranked out this simple [...]
SOLUTION! "No Control Panel for NGINX?" - VPS BIBLE Pt 17 - GUVNR January 14th, 2010 at 1:27 pm
[...] Pt 13: Multiple Sites & Blogs [...]
bo January 25th, 2010 at 12:27 am
i am getting a 403 error, and am following everything exactly, changing the URL’s and everything. any ideas?
the_guv January 25th, 2010 at 8:59 am
@bo .. “following everything exactly” .. sorry bo but, no you’re not!
you’ll have to retrace steps .. else let me know what you’re doing that’s different from Bible.
bo January 25th, 2010 at 4:03 pm
Alistair February 2nd, 2010 at 11:58 am
Well done, it is a nice idea to formalise the various guides on the net for this type of VPS configuration – as one of your other commentators remarked, many of these assume a good deal of previous knowledge and the devil is in the detail!
You have chosen NGINX which I can understand but how are you securing or optimizing the server setup?
Apache uses a range of techniques, in particular .htaccess, not available to NGINX for configuring cache control headers or for securing directories (particularly those can receive uploads. eg see http://wiki.nginx.org/PHPFcgiExample – Secure your upload directory!!
Too many example configs fail to secure the “uploads” directory of the application. Remember that if someone can upload a file named xyz.php and the uploads dir is publicly accessible then you have given the attacker an easy way to insert PHP onto your site…
the_guv February 3rd, 2010 at 9:31 am
@Alistair .. thank you. I’m planning a post about Nginx techniques for this very thing. aye aye .. so many things huh.