UbuntuServer10.04 + Nginx + MySQL + PHP + eAccelerator

Source: Internet
Author: User
Originally, we wanted to use LAMP in javastuserver10.04, but the server configuration was low. We recommend nginx for our predecessors. Write LAMP in the next article. The reason why nginx is useless to apache is that nginx is more efficient, especially for low-configuration servers 1. Install ubuntuserver10.04. The installation language is en and the time zone chongqing, only install ssh for the service, and use default for all other services. Tip: After the above installation process is complete, we recommend that you use other calculations.

Originally, we wanted to use LAMP on Ubuntu Server 10.04, but the Server configuration was low. We recommend nginx for our predecessors. Write LAMP later.

The reason why nginx is useless to apache is that nginx is more efficient, especially for low-configuration servers.

1. Install ubuntu server 10.04. The installation language is selected as en and the time zone is chongqing. The service only installs ssh, and all others are installed by default.
Tip: After the above installation is complete, it is recommended to log on to the server with another computer. putty can be used in windows, and the linux system can directly use commands on the terminal:

Code: ssh Login Name @ Server ip Address
In the following process, you must enter a large number of commands and code and paste them directly on the client (right-click putty in windows to paste the content in the clipboard to the terminal ).
2. Add Source:
Code: sudo vi/etc/apt/sources. list
Add as follows:
Code: deb http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
Deb http://archive.ubuntu.com/ubuntu/ lucid-security main restricted universe multiverse
Deb http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
Deb http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
The deb-src http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
The deb-src http://archive.ubuntu.com/ubuntu/ lucid-security main restricted universe multiverse
The deb-src http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
Deb-src http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
Deb http://ppa.launchpad.net/jdub/devel/ubuntu hard main
Note: The last line is the source of the latest nginx version (currently 0.8.36 ).
3. Update
Code: sudo apt-get update
4. Install the website system
Code: sudo apt-get install mysql-server mysql-client nginx php5-cgi php5-mysql php5-curl php5-gd php5-idn php5-imagick php5-imap php5-mcrypt php5-memcache php5-common php5-ming php5-pspell php5-recode php5-snmp php5-tidy spawn-fcgi
5. Set boot to start fastcgi Process
Code: sudo vi/etc/rc. local
Add the next row to the row 'exit 0'
Code: /usr/bin/spawn-fcgi-a 127.0.0.1-p 9000-u www-data-g www-data-f/usr/bin/php5-cgi-C 4-P/var/ run/fastcgi-php.pid
6. Create a website and log directory (my personal directory is ubuntu. Use the following command to replace ubuntu with your personal directory)
Code: mkdir/home/ubuntu/www-p
Mkdir/home/ubuntu/log-p
Ln-s/usr/share/phpmyadmin/home/ubuntu/www/phpmyadmin
7. Configure nginx
Code: sudo vi/etc/nginx. conf
You can find the specific configuration on the Internet. My Configuration:
Code: user www-data;
Worker_processes 2;
Error_log/dev/null crit;
Pid/var/run/nginx. pid;
Events {
Worker_connections 3000;
}
Http {
Autoindex on;
Autoindex_exact_size off;
Autoindex_localtime on;
Default_type application/octet-stream;
Sendfile on;
Tcp_nopush on;
Tcp_nodelay on;
Keepalive_timeout 10;
Gzip on;
Gzip_min_length 1 k;
Gzip_buffers 4 8 k;
Gzip_http_version 1.1;
Gzip_comp_level 3;
Gzip_types text/css text/xml text/plain application/x-javascript application/xml application/pdf application/x-perl application/x-tcl application/msword application/rtf application/vnd. ms-excel application/vnd. ms-powerpoint application/vnd.wap.xhtml + xml image/x-ms-bmp;
Gzip_disable "MSIE [1-6] \.";
Gzip_vary on;
Output_buffers 4 32 k;
Client_max_body_size 20 m;
Server {
Listen 80;
Server_name localhost;
Charset UTF-8, gb2312;
Access_log/home/ubuntu/log/access. log;
Location /{
Root/home/ubuntu/www;
Index index.html index.htm index. php;
}
Location ~ \. Php $ {
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Set $ path_info "/";
Set $ real_script_name $ fastcgi_script_name;
If ($ fastcgi_script_name ~ "^ (. +? \. Php) (/. +) $ "){
Set $ real_script_name $1;
Set $ path_info $2;
}
}
Location ~ . * \. (Gif | jpg | jpeg | png | bmp | swf | js | css | ico) $ {
Root/home/ubuntu/www;
Access_log off;
Expires 30d;
}
Error_page 500 502 503 x.html;
Location =/50x.html {
Root/home/ubuntu/www;
}
Fastcgi_param SCRIPT_FILENAME/home/ubuntu/www/$ real_script_name;
Fastcgi_param path_info $ path_info;
Include/etc/nginx/fastcgi_params;
}
}

Related Article

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.