For Apache VPServers running Linux. These are instructions to make your site allow more users to connect before it crashes. It has personally helped me a lot.
1. Login into your Putty. Putty SSH can be googled. Enter your username, then password and then type
2. Copy this code
then right click on your putty window and it will enter it automatically. Press Enter.
3. You will be using Vi to edit your files.
4. Use your arrow keys to maneuver down to your MaxClients It will more than likely look like this: MaxClients 50
5. Position the blue or green
cursor over the five, press i
on your keyboard (this puts you in insert mode).
6. While on the number 5
you want to press the letter x
on your keyboard.
7. Use your arrow key to the right over the number 0
and press x
8. It may look like this MaxClients xx
. Now backspace or delete the xx and enter nothing higher than 256
. I have mine set at 250, a safe bet.
9. Pres Esc (this takes you out of insert or edit mode) and go down to the next column and repeat these instructions
on the other MaxClients 50 because there are two.
10. Do not mess with any other setting unless you know what you are doing. It may look tempting to adjust some other numbers, but trust me, don't do it.
Here is a good VIM tutorial for editing.
Vi is an awesome text editor and a real necessity for a *nix SysAdmin. Here's a brief tutorial:
1.) To edit an existing file or create a new file just type vi filename.txt
2.) There are a few ways to exit Vi. If you simply viewed the file but didn't make any changes, you can just type :q
to quit. If you made changes but don't want to save them, just type :q!
(the q is obviously for 'quit' and think of the '!' as 'yes, I'm sure'. If you made changes to the file and want to write (save) them and quit, type :wq
(for write and quit).
3.) When you open a file the first thing you'll want to do is be able to move around in the file. To move the cursor down, you can just hit enter, which will take you down one line, always keeping you at the beginning of the line. Another way to move down is to hit the j
key. You can move up by hitting the k
key. These keys are right next to each other, and when your hands are in the home position on the keyboard, your right index and middle fingers will already be positioned naturally on the j and k keys, so this is very convenient. You could also use the arrow keys to move around, but it is much easier to use j and k since your hand is already there!
4.) To move forward on a line, word by word, just hit w
. To move backwards on a line, word by word, just hit b
. Oh, and to jump to the end of the file, hit shift G
5.) Searching for a certain word is another useful function. Simply type /
and the word you want to search for. For example, if you wanted to find the word 'foo' you would type /foo
and you'll go to the first occurence of that word. Hit n
to go to the next occurence of the word, or N
to go back to the previous occurence of that word.
6.) To delete a single character, move the cursor over it and then hit x
. You can replace a letter with a different letter by hitting r
(for replace) followed by the new letter you want. You can delete a word by hitting dw
(for delete word) while the cursor is anywhere on it. Or you can delete a whole line by hitting dd
. By the way, you can add numbers before the d to delete multiple words or numbers. For example, 5dd
deletes 5 lines. 5dw
deletes 5 words.
7.) If you make a mistake, just hit u
8.) If you want to add text, you will need to enter insert mode
(so far you've been in command mode, which is the defaul mode). To enter insert mode, hit i
. You can then type in text. To exit insert mode and go back to command mode, just hit the Esc
key. Since you've made changes to the file, don't forget to hit :wq
when you're ready to quit (that way your changes are saved).
Once you get accustomed to vi, you might like to use a few more shortcuts. I use these a lot, personally.
These commands are used in the default mode (NOT edit mode)...
If you want to copy and paste 1 line of text, type yy
to paste after the line on which your cursor is sitting, or P
to paste before the current line.
To copy 7 lines of text, use 7yy
... and so on....
What if you have a big file, and you want to go to line# 4359? Type :4359
What if you want to go to the last line in the file? :$
[enter] ... then you want to go back to the first line? :0
Want to know what line# number you are on? :nu
[enter] Want a word/line count? g CTRL-g
If you want to save and exit the file, simply type: ZZ
If you want to discard any changes to the file and exit, type: ZQ
Here's a formatting tip. If you use [tab] a lot to keep code and config files readable, maybe you don't like the default tab width (I know I don't, it's way too big). You can set the tab size with this command et tabstop=N
--where you want to set tab equal to N spaces. If you'd like to have this always, type :mkvimrc
( or maybe add set tabstop=N
to ~/.exrc if you're using a silly vi clone).
Like wordwrap? (or not?) et wrap
or et nowrap