In centos 5.3 install nginx0.7.67 + mysql5.1.49 + php5.2.14

Nginx ("engine x") is a high performance HTTP reverse proxy server, because of its high performance and reliability, more and more domestic websites have started using Nginx as a Web server. The following is the author most recently of the installation configuration notes.

System Version: CentOS release 5.3 (Final), installed before the server can determine the network connectivity, or wget, yum and so are unable to use the network command.

Edit / etc / resolv.conf

vim /etc/resolv.conf

In the end add the following content (* Office and fill out your DNS address), restart just fine.

nameserver ***.***.*.**
nameserver ***.***.*.**

For example, the DNS in Beijing as: and

Following is a server installation to install all the software versions:

nginx-0.7.67: nginx latest stable version
mysql-5.1.49: MySQL 5.1 series of the latest version
php-5.2.14: PHP5.2 the latest version of the series
php-5.2.14-fpm-0.5.14: compile with FastCGI mode is used when installing the patch PHP5.2.14
libiconv-1.13: Install PHP 5.2.14 build the required support library
libmcrypt-2.5.8: build install PHP 5.2.14 needed to support library
mcrypt-2.6.8: build install PHP 5.2.14 needed to support library
memcache-2.2.5: a high-performance distributed memory cache server
mhash- install PHP 5.2.14 build the required support library
pcre-8.01: pcre libraries required to install Nginx
eaccelerator-0.9.6: eAccelerator to speed up PHP
PDO_MYSQL-1.0.2: mysql pdo support
ImageMagick: ImageMagick library
imagick-2.3.0: imagick library

Above are the official closing date 2010.7.30 latest stable version, can be used directly in ssh wget command from the official website at:


Download MYSQL:

Into page in "Select Platform" select "Source Code", select the list to download the last mysql-5.1.49.tar.gz:

wget " "
wget " "
wget " "

All of the above software I used wget to "/ usr / local / src" directory, to prepare for later installation.

The following are the various directory location I used:

Site directory at: / workspace / wwwroot
Server software installation directory at: / usr / local / webserver
The original installation of the software at: / usr / local / src

Before starting the installation, we strongly recommend replacing the system of open source software out centos mirror source is open source software mirror sites Netease, this time using the yum command to install the software with the maximum download speed.

Replacement process:

cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.bak
vim CentOS-Base.repo

Fill in the vim editor and save the following:

# CentOS-Base.repo
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# Update status of each mirror to pick mirrors that are updated to and
# Geographically close to the client. You should use this for CentOS updates
# Unless you are manually picking other mirrors.
# If the mirrorlist = does not work for you, as a fall back you can try the
# Remarked out baseurl = line instead.
name = CentOS-$ releasever - Base
# Mirrorlist = = $ releasever & arch = $ basearch & repo = os
# Baseurl = $ releasever / os / $ basearch /
baseurl = $ releasever / os / $ basearch /
gpgcheck = 1
gpgkey =

# Released updates
name = CentOS-$ releasever - Updates
# Mirrorlist = = $ releasever & arch = $ basearch & repo = updates
# Baseurl = $ releasever / updates / $ basearch /
baseurl = $ releasever / updates / $ basearch /
gpgcheck = 1
gpgkey =

# Packages used / produced in the build but not released
name = CentOS-$ releasever - Addons
# Mirrorlist = = $ releasever & arch = $ basearch & repo = addons
# Baseurl = $ releasever / addons / $ basearch /
baseurl = $ releasever / addons / $ basearch /
gpgcheck = 1
gpgkey =

# Additional packages that may be useful
name = CentOS-$ releasever - Extras
# Mirrorlist = = $ releasever & arch = $ basearch & repo = extras
# Baseurl = $ releasever / extras / $ basearch /
baseurl = $ releasever / extras / $ basearch /
gpgcheck = 1
gpgkey =

# Additional packages that extend functionality of existing packages
name = CentOS-$ releasever - Plus
# Mirrorlist = = $ releasever & arch = $ basearch & repo = centosplus
# Baseurl = $ releasever / centosplus / $ basearch /
baseurl = $ releasever / centosplus / $ basearch /
gpgcheck = 1
enabled = 0
gpgkey =

Preparation before starting the installation

1, all the server environment is installed in / usr / local / webserver directory:

mkdir -p /usr/local/webserver

2, create a web root directory

mkdir -p /workspace/wwwroot

3, CentOS Linux system using yum command that comes with the installation, upgrade the required libraries (RedHat and other Linux distributions can be found from the installation CD in the library of the RPM package to install)

yum-y install gcc gcc-c + + autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

yum-y install gettext

fastcgi installation of PHP will be used, if there is no need to implement package yum command to install

yum-y install patch

Install nginx will use pcre library, if there is no need to implement package yum command to install

yum-y install pcre-devel

2, then began to compile install MYSQL

tar-zxvf mysql-5.1.49.tar.gz
cd mysql-5.1.49
groupadd mysql
useradd-g mysql mysql
. / Configure-prefix = / usr / local / webserver / mysql-with-comment = Source-with-server-suffix =- enterprise-gpl-with-mysqld-user = mysql-without-debug-with-socket-path = / tmp / mysql.sock-with-big-tables-with-charset = utf8-with-collation = utf8_general_ci-with-extra-charsets = all-with-pthread-enable-static-enable-thread-safe-client-with -client-ldflags =- all-static-with-mysqld-ldfags =- all-static-enable-assembler-without-ndb-debug-enable-local-infile-with-readline-with-raid-with-low-memory
make install

The entire installation process, MYSQL is the slowest part, so they need a little patience, if you are in the implementation of "make install" time, has been stuck in the "make [4]: Entering directory` / usr / local / src / mysql -5.1.49/mysql-test '", it is because you are too impatient, and so on compiled, and Oh, the card in the time-consuming process of about 20 minutes. Take advantage of this process go a cup of tea.

Compile the installation is complete, start the configuration MYSQL, concrete steps are not explained on the first, can be found online, just need to follow what these steps:

cd /usr/local/webserver/mysql
cp /usr/local/webserver/mysql/share/mysql/my-medium.cnf /etc/my.cnf
/usr/local/webserver/mysql/bin/mysql_install_db --user=mysql

chown -R root /usr/local/webserver/mysql/
chown -R root /usr/local/webserver/mysql/var/
chown -R root /usr/local/webserver/mysql/var/mysql
chown -R mysql /usr/local/webserver/mysql/
chown -R mysql /usr/local/webserver/mysql/var/
chown -R mysql /usr/local/webserver/mysql/var/mysql

Increase the MYSQL service at startup:

cp /usr/local/webserver/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
chmod 700 /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 3 mysqld on

Start MYSQL service

service mysqld start

Setting MYSQL password to "111111" (6 1)

/usr/local/webserver/mysql/bin/mysqladmin -u root password 111111
cp /usr/local/webserver/mysql/bin/mysql /sbin/mysql
cp /usr/local/webserver/mysql/bin/mysqldump /sbin/mysqldump

Test MYSQL is installed correctly:

Into MYSQL: mysql-uroot-p
See all Database: show databases;
Select a database: use mysql;
Show all under the selected database table name: show tables;
Exit MYSQL: \ q

Third, build the support needed to install PHP 5.2.14 library

tar zxvf libiconv-1.13.tar.gz
cd libiconv-1.13/
./configure --prefix=/usr/local
make install
cd ../

tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
make install
cd libltdl/
./configure --enable-ltdl-install
make install
cd ../../

tar zxvf mhash-
cd mhash-
make install
cd ../

ln -s /usr/local/lib/ /usr/lib/
ln -s /usr/local/lib/ /usr/lib/
ln -s /usr/local/lib/ /usr/lib/
ln -s /usr/local/lib/ /usr/lib/
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/ /usr/lib/
ln -s /usr/local/lib/ /usr/lib/
ln -s /usr/local/lib/ /usr/lib/
ln -s /usr/local/lib/ /usr/lib/

tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
make install
cd ../

Fourth, in order to compile the installation of PHP 5.2.14 FastCGI mode

tar zxvf php-5.2.14.tar.gz
gzip-cd php-5.2.14-fpm-0.5.14.diff.gz | patch-d php-5.2.14-p1
cd php-5.2.14 /
. / Configure-prefix = / usr / local / webserver / php-with-config-file-path = / usr / local / webserver / php / etc-with-mysql = / usr / local / webserver / mysql-with-mysqli = / usr / local / webserver / mysql / bin / mysql_config-with-iconv-dir = / usr / local-with-freetype-dir-with-jpeg-dir-with-png-dir-with-zlib-with-libxml -dir = / usr-enable-xml-disable-rpath-enable-discard-path-enable-safe-mode-enable-bcmath-enable-shmop-enable-sysvsem-enable-inline-optimization-with-curl-with- curlwrappers-enable-mbregex-enable-fastcgi-enable-fpm-enable-force-cgi-redirect-enable-mbstring-with-mcrypt-with-gd-enable-gd-native-ttf-with-openssl-with-mhash - enable-pcntl-enable-sockets-with-xmlrpc-enable-zip-enable-soap-without-pear
make ZEND_EXTRA_LIBS = '-liconv'
make install
cp php.ini-dist / usr / local / webserver / php / etc / php.ini
cd .. /

5, compile install PHP5 Extension Module

tar zxvf memcache-2.2.5.tgz
cd memcache-2.2.5/
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make install
cd ../

tar jxvf eaccelerator-0.9.6.tar.bz2
cd eaccelerator-0.9.6/
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/webserver/php/bin/php-config
make install
cd ../

tar zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2/
./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-pdo-mysql=/usr/local/webserver/mysql
make install
cd ../

tar zxvf ImageMagick.tar.gz
cd ImageMagick-6.5.1-2/
make install
cd ../

tar zxvf imagick-2.3.0.tgz
cd imagick-2.3.0/
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make install
cd ../

6, modify the php.ini file

1, hand-modified: Search / usr / local / webserver / php / etc / php.ini the extension_dir = ". /"

vim / usr / local / webserver / php / etc / php.ini
Amended to read extension_dir = "/ usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613 /"
And after this line add the following lines, then save:
extension = ""
extension = ""
extension = ""

Then find output_buffering = Off
Revised to output_buffering = On

Look again; cgi.fix_pathinfo = 0
Revised cgi.fix_pathinfo = 0, to prevent the file type error parsing vulnerability Nginx.

2, automatic modification: if too troublesome manual changes, perform the following shell command, automatically changes to the php.ini file:

sed-i 's # extension_dir = "./"# extension_dir = "/ usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613 /" \ nextension = "" \ nextension = "" \ nextension = "" \ n # '/ usr / local / webserver / php / etc / php.ini
sed-i 's # output_buffering = Off # output_buffering = On #' / usr / local / webserver / php / etc / php.ini
sed-i "s #; always_populate_raw_post_data = On # always_populate_raw_post_data = On # g" / usr / local / webserver / php / etc / php.ini
sed-i "s #; cgi.fix_pathinfo = 0 # cgi.fix_pathinfo = 0 # g" / usr / local / webserver / php / etc / php.ini

7, configure eAccelerator accelerated PHP

Create eaccelerator cache directory, and edit php.ini

mkdir -p /usr/local/webserver/eaccelerator_cache
vim /usr/local/webserver/php/etc/php.ini

Press shift + g keys jump profile at the very end, add the following configuration information:

zend_extension = "/ usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/"
eaccelerator.shm_size = "64"
eaccelerator.cache_dir = "/ usr / local / webserver / eaccelerator_cache"
eaccelerator.enable = "1"
eaccelerator.optimizer = "1"
eaccelerator.check_mtime = "1"
eaccelerator.debug = "0"
eaccelerator.filter = ""
eaccelerator.shm_max = "0"
eaccelerator.shm_ttl = "3600"
eaccelerator.shm_prune_period = "3600"
eaccelerator.shm_only = "0"
eaccelerator.compress = "1"
eaccelerator.compress_level = "9"

8, create a www user and group, and the use of the directory for the virtual host:

/usr/sbin/groupadd www
/usr/sbin/useradd -g www www

Assuming you already have a domain name have to point the server IP. You need to add the virtual host site: (If you currently no available domain name, you want to use the IP direct access to, then no need for the following operation. NGINX to be installed after the configuration file can be in nginx.conf)

mkdir -p /workspace/wwwroot/
chmod +w /workspace/wwwroot/
chown -R www:www /workspace/wwwroot/

Later to add a new virtual host, then repeat the steps above you can run.

9, create php-fpm configuration file (php-fpm is a fight for the PHP FastCGI patch management, you can change the php.ini configuration without the need for a smooth restart php-cgi)

In / usr / local / webserver / php / etc / directory to create php-fpm.conf file:

rm -f /usr/local/webserver/php/etc/php-fpm.conf
vim /usr/local/webserver/php/etc/php-fpm.conf

Enter the following (if you install Nginx + PHP for debugging, set the following 0 to 1, to show PHP error messages, otherwise, Nginx will report a blank state of 500 error page):

All relative paths in this config are relative to php's install prefix

Pid file
/ Usr / local / webserver / php / logs /

Error log file
/ Usr / local / webserver / php / logs / php-fpm.log

Log level

When this amount of php processes exited with SIGSEGV or SIGBUS ...

... In a less than this interval of time, a graceful restart will be initiated.
Useful to work around accidental curruptions in accelerator's shared memory.

Time limit on waiting child's reaction on signals from master

Set to 'no' to debug fpm

Name of pool. Used in logs and stats.

Address to accept fastcgi requests on.
Valid syntax is ' port' or just 'port' or '/ path / to / unix / socket'
/ Tmp / php-cgi.sock

Set listen (2) backlog

Set permissions for unix socket, if one used.
In Linux read / write permissions must be set in order to allow connections from web server.
Many BSD-derrived systems allow connections regardless of permissions.


Additional php.ini defines, specific to this pool of workers.

/ Usr / sbin / sendmail-t-i

Unix user of processes

Unix group of processes

Process manager settings

Sets style of controling worker process count.
Valid values are 'static' and 'apache-like'

Sets the limit on the number of simultaneous requests that will be served.
Equivalent to Apache MaxClients directive.
Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
Used with any pm_style.

Settings group for 'apache-like' pm style

Sets the number of server processes created on startup.
Used only when 'apache-like' pm_style is selected

Sets the desired minimum number of idle server processes.
Used only when 'apache-like' pm_style is selected

Sets the desired maximum number of idle server processes.
Used only when 'apache-like' pm_style is selected

The timeout (in seconds) for serving a single request after which the worker process will be terminated
Should be used when 'max_execution_time' ini option does not stop script execution for some reason
'0 S 'means' off'

The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file
'0 S 'means' off'

The log file for slow requests
logs / slow.log

Set open file desc rlimit

Set max core size rlimit

Chroot to this directory at the start, absolute path

Chdir to this directory at the start, absolute path

Redirect workers' stdout and stderr into main error log.
If not set, they will be redirected to / dev / null, according to FastCGI specs

How much requests each process should execute before respawn.
Useful to work around memory leaks in 3rd party libraries.
For endless request processing please specify 0

Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect.
Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2 +)
Makes sense only with AF_INET listening socket.

Pass environment variables like LD_LIBRARY_PATH
All $ VARIABLEs are taken from current environment

/ Usr / local / bin: / usr / bin: / bin
/ Tmp
/ Tmp
/ Tmp

Php-cgi started the process of monitoring the 9000 port, the process number of 128 (if the server memory is less than 3GB, you can only open 64 process), user www:

ulimit -SHn 65535
/usr/local/webserver/php/sbin/php-fpm start

Note: / usr / local / webserver / php / sbin / php-fpm there are other parameters, including: start | stop | quit | restart | reload | logrotate, modify the php.ini does not restart after the php-cgi, re-load the configuration file using the reload.

10, install nginx-0.7.67

tar zxvf nginx-0.7.67.tar.gz
cd nginx-0.7.67 /
. / Configure-user = www-group = www-prefix = / usr / local / webserver / nginx-with-http_stub_status_module-with-http_ssl_module
make & & make install
cd .. /

Create log directory Nginx

mkdir -p /logs/nginx
chmod +w /logs/nginx
chown -R www:www /logs/nginx

Create Nginx configuration file:

①, in the / usr / local / webserver / nginx / conf / directory to create nginx.conf file:

rm -f /usr/local/webserver/nginx/conf/nginx.conf
vim /usr/local/webserver/nginx/conf/nginx.conf

Enter the following:

user www www;
worker_processes 8;

error_log / logs / nginx / nginx_error.log crit;

pid / usr / local / webserver / nginx /;

# Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 65535;

use epoll;
worker_connections 65535;

include mime.types;
default_type application / octet-stream;

server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;

sendfile on;
tcp_nopush on;

keepalive_timeout 60;

tcp_nodelay on;

fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;

gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
# Gzip_http_version 1.0;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text / plain application / x-javascript text / css application / xml;
gzip_vary on;

server_name_in_redirect off;

# Limit_zone crawler $ binary_remote_addr 10m;

listen 80;
index index.html index.htm index.php;
root / workspace / wwwroot /;

# Limit_conn crawler 20;

location ~ .* \. (php | php5)? $
fastcgi_pass unix: / tmp / php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;

location ~ .* \. (gif | jpg | jpeg | png | bmp | swf) $
expires 30d;

location ~ .* \. (js | css)? $
expires 1h;
access_log off;

listen 80;

location / (
stub_status on;
access_log off;

②, in the / usr / local / webserver / nginx / conf / directory to create fcgi.conf file:

vim /usr/local/webserver/nginx/conf/fcgi.conf

Enter the following:

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param QUERY_STRING $ query_string;
fastcgi_param REQUEST_METHOD $ request_method;
fastcgi_param CONTENT_TYPE $ content_type;
fastcgi_param CONTENT_LENGTH $ content_length;

fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
fastcgi_param SCRIPT_NAME $ fastcgi_script_name;
fastcgi_param REQUEST_URI $ request_uri;
fastcgi_param DOCUMENT_URI $ document_uri;
fastcgi_param DOCUMENT_ROOT $ document_root;
fastcgi_param SERVER_PROTOCOL $ server_protocol;

fastcgi_param REMOTE_ADDR $ remote_addr;
fastcgi_param REMOTE_PORT $ remote_port;
fastcgi_param SERVER_ADDR $ server_addr;
fastcgi_param SERVER_PORT $ server_port;
# Fastcgi_param SERVER_NAME $ server_name;
fastcgi_param SERVER_NAME $ host;

# PHP only, required if PHP was built with-enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;

Start Nginx:

ulimit -SHn 65535

Configuration at startup Nginx + PHP

vim /etc/rc.local

Increase at the end the following:

ulimit-SHn 65535
/ Usr / local / webserver / php / sbin / php-fpm start
/ Usr / local / webserver / nginx / sbin / nginx

Optimized Linux kernel parameters:

vim /etc/sysctl.conf

Increase at the end the following:

net.ipv4.tcp_max_syn_backlog = 65536
net.core.netdev_max_backlog = 32768
net.core.somaxconn = 32768
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216

net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2

net.ipv4.tcp_tw_recycle = 1
# Net.ipv4.tcp_tw_len = 1
net.ipv4.tcp_tw_reuse = 1

net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_max_orphans = 3276800

# Net.ipv4.tcp_fin_timeout = 30
# Net.ipv4.tcp_keepalive_time = 120
net.ipv4.ip_local_port_range = 1024 65535

The configuration take effect immediately:

/sbin/sysctl -p

In the non-stop service where Nginx Nginx configuration smooth change
1, modify the / usr / local / webserver / nginx / conf / nginx.conf configuration file, run the following command to check the configuration file is correct:

/usr/local/webserver/nginx/sbin/nginx -t

If the screen displays the following two lines of information on the correct configuration file:

the configuration file / usr / local / webserver / nginx / conf / nginx.conf syntax is ok
the configuration file / usr / local / webserver / nginx / conf / nginx.conf was tested successfully

2, create

vim /usr/local/webserver/nginx/

Enter the following content and save:

/ Usr / local / webserver / php / sbin / php-fpm reload
kill-HUP `cat / usr / local / webserver / nginx /`

Change permissions:

chmod 777 /usr/local/webserver/nginx/

Later revised nginx.conf, php-fpm.conf, fcgi.conf 3 files in the configuration parameters, only need to run the following shell command to restart the nginx and PHP services:


If you want to stop NGINX service, run:

kill -TERM `cat /usr/local/webserver/nginx/`

Preparation time per day cut the log scripts Nginx
1, create a script / usr / local / webserver / nginx / sbin /

vim /usr/local/webserver/nginx/sbin/

Enter the following:

#! / Bin / bash
# This script run at 00:00
# The Nginx logs path
logs_path = "/ usr / local / webserver / nginx / logs /"

mkdir-p $ (logs_path) $ (date-d "yesterday" + "% Y ")/$( date-d" yesterday "+"% m ") /
mv $ (logs_path) access.log $ (logs_path) $ (date-d "yesterday" + "% Y ")/$( date-d" yesterday "+"% m ") / access_ $ (date-d" yesterday "+"% Y% m% d "). log
kill-USR1 `cat / usr / local / webserver / nginx /`

2, set the crontab, 00:00 am every day access log cutting nginx:

crontab -e

Enter the following and save:

00 00 * * * / bin / bash / usr / local / webserver / nginx / sbin /

Note: If you can not run the crontab command, may be due to many vps is not / bin / vi, leading to implementation of the crontab tips / bin / vi error. Workaround is to install the vim and set as the default editor, as follows:
1. Install vim

yum install vim-enhanced

2. Modify / etc / profile file to include

export EDITOR = / usr / bin / vim

3. To / etc / profile file changes take effect immediately, you can use the following command:

. /etc/profile

Note:. And / etc / profile spaces
4. Run crontab-e, there editing interface and success.

This point, basically have been installed throughout the environment is good, no accidents, you can already paid a successful visit to the host before you create the virtual directory "", but all have accidents, and if done this everything, you find that your server environment or can not resolve, please take a close look, I would run into this problem. Our step by step to troubleshoot:

The following command to see port:

netstat -ntal

If the 80-port has been at work, probably because of firewall rules blocking the reason:

1, stop the firewall:

service iptables stop

2, stopped to see whether after open website, If so, then determine the reasons for the firewall, we need to re-configure the firewall rules:

vim /etc/sysconfig/iptables

3, add the following and save:

-A RH-Firewall-1-INPUT-m state-state NEW-m tcp-p tcp-dport 80-j ACCEPT
-A RH-Firewall-1-INPUT-m state-state NEW-m tcp-p tcp-dport 3306-j ACCEPT

4, open the firewall

service iptables start

If you find access to the secondary directory server when NGINX can not resolve, such as access to "", the server can not resolve to the test directory, and access "http://www.test. com / test / "then everything is normal: just add the following line in nginx.conf can:

server_name_in_redirect off;

Thus, the great merit of basic rolled together. But I configured the server memory for the 3G, CPU is a dual-core, so each performance parameter index configuration are in accordance with this hardware standard to set, in the actual production environment, Yi Shang NGINX and PHP configuration in the hardware for items under good, but most probably a few hundred M memory VPS hosting, or install and configure their own virtual machine environment, so all the configuration parameters need to keep tuning. Next I will talk about what are the NGINX configuration will affect the operation, how the configuration was the most reasonable. Otherwise, it is easy to occur NGINX 504 errors or other mistakes. In fact, all this can not be counted as NGINX's fault, as long as reasonable allocation of the various parameters, such a situation is completely avoidable.

分类:OS 时间:2010-08-21 人气:539
blog comments powered by Disqus


  • 解压缩tar.gz文件 2014-06-15

    题目如下: 定义文件xx.tar.gz的产生方式如下: •以xx为文件名的文件通过tar 和gzip打包压缩产生,该文件中以字符串的方式记录了一个非负整数: •或者以xx为名的目录通过tar和gzip打包压缩产生,该目录中包含若干xx.tar.gz. 其中,x2[0, 9]. 现给定一个根据上述定义生成的文件00.tar.gz,请确定其中包含的以xx为文件名的文件个数以及这些文件中所记录的非负整数之和. 解压tar.gz文件需要用到的包: <dependency> <groupId>

  • Squid proxy server quick installation (original) 2010-05-08

    Squid2.7 + webmin1.5 + SARG2.2.7 Installation Environment: CentOS 5.4 (A) Squid To the official website to download the latest installation package squid-2.7.STABLE9 Extract, compile and install > Tar zxf squid-2.7.STABLE9.tar.gz >. / Configure / us

  • mysql-5.1.40-linux-i686-glibc23.tar.gz installation notes 2011-04-15

    mysql-5.1.40-linux-i686-glibc23.tar.gz installation notes 1 First, add the mysql user group Shell Code shell> groupadd mysql 2 Add the mysql user and mysql user group assigned to Shell Code shell> useradd -g mysql mysql 3 Extract the mysql-version.t

  • samba installation source (tar.gz) 2011-05-14

    The core is two samba daemons smbd and nmbd process during a server start to stop running. Smbd and nmbd to use the full configuration information are all stored in the smb.conf file. Smb.conf smbd and nmbd to the description of two daemons output no

  • samba source installation (tar.gz) 2011-05-14

    The core is two samba daemons smbd and nmbd program to stop the server during startup and running. Smbd and nmbd to use all the configuration information are all stored in the smb.conf file. Smb.conf to two daemons smbd and nmbd to explain what the o

  • mysql under linux binaries (tar.gz) installation 2010-05-22

    ubuntu is very easy to install mysql, ubuntu directly if you are running: To install MySQL, you can run the following terminal command prompt: sudo apt-get install mysql-server sudo apt-get install mysql-client sudo apt-get install php5-mysql / / Ins

  • linux source code installation installation rpm.tar.gz experience 2011-01-21

    rpm package installation package if there is interdependence can install multiple rpm packages Such as: rpm-i asdf.rpm asdf.rpm tar.gz source package installation time .. If the. / Configure can not make the situation after .. look out. / Configure t

  • Learn Linux, compile and install mysql-5.0.45.tar.gz 2011-04-24

    Compiled under Linux install mysql-5.0.45.tar.gz Reproduced <! - Body start -> (1) ------------- ---------- Preparatory work 1: If the downloaded file is named: mysql-5.0.45.tar.gz 2: If the copy to the / home under the 3: groupadd mysql # add the m

  • ubuntu 11.4 binaries (tar.gz) install mysql 5.5.x 2011-08-31

    For some reason, I need to use a higher one o'clock version of mysql, but ubuntu using apt-get install mysql version is not the version I expected (I used to test the ubuntu-11-04 apt-get install mysql, mysql version is 5.1 .54; ubuntu-10-04 apt-get

  • tar.gz and tar.bz2 detailed explanation 2011-09-28

    Most packaged in tar.gz and tar.bz2 software, mostly through the. / Configure; make; make install to install; some software is directly make; make install; We can. / Configure - help to see the configuration software functions; most software is avail

iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C), All Rights Reserved. 版权所有 闽ICP备15018612号

processed in 0.295 (s). 13 q(s)