Summary of VPs website construction in Linux

Source: Internet
Author: User

 

I wanted to build a website in VPS, so I spent some money to buy a burstnet Linux VPs. For the first time, I did not know the direction at all, especially the program on Linux Online on Windows. After learning the online tutorials and experience, I used a night to build a website. Below I will record the process to facilitate future queries.

VPS (virtual private server) Technology

 

After you purchase the right to use VPs from the seller, you will get the VPs address, and the SSH logon password. Some vendors also have the VPs control panel, which will include the account and password. Based on the provided address, you can access your VPS panel, view parameters, and experience some simple functions, such as viewing the file system, ping the network speed, backup, and so on.

 

The functions provided by the Panel are still very limited. to operate your virtual private server more smoothly, you need to use some tools to connect to your VPS and then perform operations on it. I am using putty (I will see the tutorial first. It is said that some visual tools can operate Linux systems like remote desktop, but they have not been studied ).

 

Putty a Windows platform remote login Linux gadgets, here provides a: http://www.chiark.greenend.org.uk /~ Sgtatham/Putty/download.html

Open putty and go to its logon interface.

Enter the host address and you will be able to log on. After entering the system, I found that the annoying text operating system appeared. Do you think of dos. Most commands are similar, but this is a Linux Command. Well, let's take a look at the putty commands.

A. display file source code
Catooxx. php
Yes, cat is a common command for viewing Source Code. Its advantage is that it is very convenient and cute. The disadvantage is that all source code is directly refreshed and displayed. If the file is too long, you can only see the code behind your ass.

B. view the current directory
PWD
PWD is not a password, but a view of the current directory. The complete path is output.

C. Change directory change Directory (cd)
CD/path/to/directory/
If you have a basic dos, you should smile awkwardly. The path can be relative or absolute.

D. List Files/subdirectories listing files/subfolders (LS)
Ls
By default, only the file name is displayed. You can also play with a parameter, for example
Ls-ALH
The output with-ALH will be nice... Try it by yourself. Big cats like to set LS-ALH to ll.
-A: displays all files.
-L detailed list
-H what humans can understand, for example, display 1024 as 1 K

E. Help
Command -- Help
If any command is followed by a-HELP command, a simple version of help will be displayed. If you cannot remember the parameters, check them.

F. Obtain the remote file wget
Wgethttp: // ooxx. Me/me.jpg
You will get the remote me.jpg file to the current directory.
Let the server get data from another server, the speed will be completely different from that of men

G. compression and decompression
Unzipwordpress.zip
If the file is in ZIP format, for example, if you have just obtained a compressed package from the WordPress main site wget, you only need to enter the unzip file name to decompress it to the current directory.
Tar-czvf ooxx.tar.gz *
Pack all files in the current directory as ooxx.tar.gz files by using the tar command.
-C create
-Z: gzip Compression
-V shows the compression process
-F creates a file.
Tar-xzvf ooxx.tar.gz
Decompress ooxx.tar.gz to the current directory.
-X Extract
-Z: gzip Compression
-V shows the compression process
-F creates a file.

H. execute a program

Sh file name

Some systems support the./file name method, but the VPs I bought does not seem to support. I have been stuck on this issue for a long time. I will not execute it here after looking at the code from others' tutorials. The "Sh file name" can be executed.

2. File System commands

A. Display disk usage
DF
Displays the total capacity and ratio of the entire host.

B. list file/subdirectory usage (DU)
Du
Will list the size of all files and subdirectories, not viewed by people...
Du-SH
-S is summary and only the total capacity of the current folder is output.
-H is generally the meaning of human in Linux, which converts 1048580b to 1 MB.
Du-h -- Max-depth = 1
Hey, only list the occupied size of the current folder and the first-level subdirectory

C. commands that are not suitable for deleting files (RM) always need to be confirmed.
Rm-VF Miao. In
To forcibly delete the file Miao. In, you do not need to confirm the list of deleted files.

Force Delete, do not execute, unless you know what you are doing...
-A vlike v parameter indicates a display process.
-F will words of rape be spelled out? F-U-C-K abbreviation, not sure direct F-word
Rm-RF ooxx
Delete the ooxx folder, including its sub-files and sub-folders.

The following command is used to delete a file. However, when deleting a folder, you need to traverse the file.
-R is localized. It is the abbreviation of "day". It indicates recursive in all commands. Note that some commands are in uppercase.

D. copy a file (CP)
Cpooxx. Me Miao. In
Copy the ooxx. Me file and rename it Miao. In.

E. Move file/Rename (MV)
Mvooxx. Me Miao. In
Rename ooxx. Me as Miao. In
If a path is added, it is moved to a path and renamed as Miao. In.
Unlike dos, changing the way of moving files and renaming is actually a routine, isn't it?

F. Create an empty file (touch)
Touchmiao. In
This very pornographic command creates an empty Miao. In file.
If you touch an existing file, the file will be updated to the current date.
If the touch count is too high

3. File Permission

A. Change the File Permission (chmod)
Chmod777 Miao. In
The default file is 644, And the folder is 755.

Tip:
1st digit = owner; 2nd = group; 3rd = Other
(-Rwxrwxwrx = 777,-rwxr-XR-x = 755,-RW-r-= 644, etc .)
7 = read + write + Execute
6 = read + write
5 = read + Execute
4 = read
3 = write + Execute
2 = write
1 = Execute
0 = All Access Denied

4. Advanced commands

A. Search for Common commands. Let's look for files larger than 10 MB.
Find.-Type F-size + 10000 K-exec LS-lH {}/; | awk '{print $5 ":" $9}' | sort-n

B. grep, holding a big watermelon in his hand
Ls-ALH | grep ooxx
Only the columns containing ooxx are displayed. Of course, it is very convenient for you to use it with some fields in the file during cat.

C. Paging (less/more)
Lessmiao. php
If the source code is very long, it will be displayed on pages, the up and down arrows scroll, enter Q to exit
Tail-N 1000/var/log/httpd/error_log | more
You can use the | more parameter to scroll the page or line.

5. MySQL database

Export Database
Mysqldump-u database username-P Database Name> db_ooxx. SQL
The exported database is db_ooxx. SQL.

Import Database
Mysql-u database username-P database name <db_ooxx. SQL -- default-character-set = utf8
Import the db_ooxx. SQL in the current directory in utf8 encoding. Of course, if you were a GBK, change it to GBK.
This is often the case when a Chinese Blog is not careful ??? Question mark

6. vi

Pay attention to every key typed in vi... ...

7. Create a system-level user useradd-r user name for logging on to SSH passwd [user name]

 

Knowing how to remotely control the Linux system is not enough. We need to find some convenient tools to ease our work. The most urgent task is how to upload files to VPs, our predecessors recommended a winscp to transfer files like traditional FTP. Here is a download: http://www.skycn.com/down.php? Uri = http: // 222.218.45.52: 82/down/winscp435setup.zip

Link to your VPS. The interface is as follows:

Are you familiar with the same operations as CuteFTP and flashfxp. The file transfer problem is solved.

 

 

An important task of building a website is to build a web environment, so how to build a lamp (that is, a website server architecture such as Apache, MySQL, and PHP in Linux ), or lnmp (such as nginx, MySQL, and PHP in Linux.

Our predecessors have contributed to us. Someone has released a one-click installation package. Use Putty to connect to the VPs and enter the following command:

Http://soft.vpser.net/lnmp/lnmp0.7.tar.gz wget-C
Tar zxvf lnmp0.7.tar.gz
CD lnmp0.7/
./Centos. Sh

The installation will take about half an hour after execution. Install nginx, MySQL, PHP, etc.

Install other components
1. Install eaccelerator and execute the following command:./eaccelerator. Sh will automatically install and restart the web service.
2. Install ioncube and run the following command:./ioncube. Sh will automatically install and restart the web service.
3. Install the pureftpd and Management Panel and run the following command :. /pureftpd. sh press the prompt to enter your MySQL Root Password, FTP User Management Panel password, and MySQL FTP Database Password (you can press enter to automatically generate a password). Press enter to confirm, the pureftpd is automatically installed. After the installation, run http: // your domain name or IP/FTP/in the browser and enter the password of the FTP user management panel you set earlier, it can be managed.
4. Install vsftpd and run the following command :. /vsftpd. sh will automatically install vsftpd. You only need to run the command: useradd-D/home/wwwroot-S/sbin/nologin adminftp to add the account to specify the root directory of the FTP account, run passwd adminftp to set the password and then log on.

VM management
1. Add a VM and run the following command:/root/vhost. sh enter the domain name to be bound as prompted, and press Enter. If you want to add more domain names, enter y, and then enter the domain name to be bound. Multiple Domain names can be separated by spaces. Enter the directory to which the domain name is bound (absolute directory, such as/home/wwwroot/lnmp. If this parameter is left blank, the default domain name is/home/wwwroot/.), and then select whether to add pseudo-static rules, by default, discuz, WordPress, sablog, emlog, and dabr are available. You can directly enter the Preceding Names. To add custom pseudo-static rules, enter the desired name, the program will automatically create a pseudo-static file, directly under/usr/local/nginx/CONF/your custom pseudo-static name. conf
Add pseudo-static rules. Next, you will be prompted whether to enable the log function. Generally, you do not need to start it. Simply enter n. If you need to start it, enter y, and then enter the name of the log file to be defined, press enter to automatically add a VM.
2. Delete the VM and run RM/usr/local/nginx/CONF/vhost/Domain Name. conf on SSH.

Status Management
Lnmp status management:/root/lnmp {START | stop | reload | restart | kill | status}
Nginx status management:/etc/init. d/nginx {START | stop | reload | restart}
PHP-FPM status management:/etc/init. d/PHP-FPM {START | stop | quit | restart | reload | logrotate}
Pureftpd status management:/etc/init. d/pureftpd {START | stop | restart | kill | status}
MySQL status management:/etc/init. d/MySQL {START | stop | restart | reload | force-Reload | status}

Graphic Interface Program
Phpinfo: http: // The domain name or IP address entered earlier/phpinfo. php
PhpMyAdmin: http: // The domain name or IP address entered earlier/PHPmyAdmin/
Probe: http: // The previously entered domain name or IP/P. php
Pureftp Management Interface: http: // The domain name or IP address entered earlier/FTP/

Lnmp directory
Nginx:/usr/local/nginx
MySQL:/usr/local/MySQL
PHP:/usr/local/PHP
Website directory:/home/wwwroot/
Nginx log directory:/home/wwwlogs/

Lnmp configuration file
Nginx main configuration file:/usr/local/nginx/CONF/nginx. conf
MySQL configuration file:/etc/My. CNF
PHP configuration file:/usr/local/PHP/etc/PHP. ini
Pureftpd configuration file:/usr/local/pureftpd/pure-ftpd.conf
Pureftpd MySQL profile:/usr/local/pureftpd/pureftpd-mysql.conf

 

Bind the domain name and publish your webpage to the root/home/domain name.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.