It has always been a one-click Web server, but the environment is relatively old for one-click construction. If you want to use a relatively new environment, especially the official server, you have to manually compile the build (the following build based on the Linux centos6.5 32-bit server).
1, Nginx
Version: 1.5
: http://nginx.org/download/nginx-1.5.2.tar.gz
2. mysql
Version 5.5
: http://downloads.mysql.com/archives/mysql-5.0/mysql-5.5.30.tar.gz
3. php
Version 5.4
: Http://am1.php.net/get/php-5.4.34.tar.gz/from/this/mirror
One: Install Nginx
Install some dependent packages:
- Yum-y install gcc gcc-C++GCC-devel gcc-C++-devel SSL SSL-devel autoconf make aclocal libtool expat-devel libxml2-devel OpenSSL OpenSSL-devel zlib zlib-devel bzip2 bzip2-devel GD GD-devel libmcrypt Libmcrypt-devel libxpm-Devel Curl-devel LIBGD-devel GD-devel OpenLDAP-devel
Enter a directory:
- / opt /
Download and unzip:
- wget http : //nginx.org/download/nginx-1.5.2.tar.gz
- - zxf Nginx - 1.5 . 2.tar . GZ
- wget http : //labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz
- - zxf Ngx_cache_purge - 2.1 . Tar . GZ
Enter the directory and compile:
- CD Nginx - 1.5 . 2
- ./Configure--prefix=/usr/Local/Nginx--Sbin-Path=/usr/Local/Nginx/Sbin/Nginx--conf-Path=/usr/Local/Nginx/conf/Nginx.conf--Error-Log-Path=/usr/Local/Nginx/Log/Error.Log--http-Log-Path=/usr/Local/Nginx/Log/Access.Log--PID-Path=/usr/Local/Nginx/Run/Nginx.PID--User=www--Group=www-- with-Http_ssl_module-- with-Http_flv_module-- with-Http_stub_status_module-- with-Http_gzip_static_module--http-Client-Body-Temp-Path=/usr/Local/Nginx/tmp/Client--http-Proxy-Temp-Path=/usr/Local/Nginx/tmp/Proxy/ --http-fastcgi-Temp-Path=/usr/Local/Nginx/tmp/fcgi/ --Add-Module=.. /Ngx_cache_purge-2.1 -- with-Pcre=.. /Pcre-8.34
- Make && Make Install
This completes the construction of Nginx.
Run:/usr/local/nginx/sbin/nginx
Error: Nginx: [Emerg] Getpwnam ("www") failed
Remove user Nobody comments in nginx.conf, change to www
Run again:/usr/local/nginx/sbin/nginx
Error: Nginx: [Emerg] Getpwnam ("www") failed in/usr/local/nginx/conf/nginx.conf:1
The reason for the error is that the WWW user is not created and should be added to the server system www users and users www, such as the following command:
- - F www
- - g www www
Third run:/usr/local/nginx/sbin/nginx
Error: Nginx: [Emerg] mkdir () "/usr/local/nginx/tmp/client" failed (2:no such file or directory)
Execution: Mkdir-p/usr/local/nginx/tmp/client
Then the localhost access will be able to see:
Accustomed to/etc/init.d/nginx start? Think/usr/local/nginx/sbin/nginx too long?
Vim/etc/init.d/nginx
- #!/bin/bash
- #
- # Init file for Nginx server daemon
- #
- # chkconfig:234 99 99
- # Description:nginx Server Daemon
- #
- # source Function Library
- . /etc/RC. D / Init . D / functions
- # Pull in Sysconfig settings
- [ -F /etc/sysconfig/Nginx ] && . /etc/sysconfig/nginx
- RETVAL = 0
- Prog = "Nginx"
- PAT = /usr/ Local / Nginx
- Nginxd = /usr/ Local / Nginx / Sbin / Nginx
- Pid_file = /usr/ Local / Nginx / Nginx . PID
- Start ()
- {
- Echo - N $ "Starting $prog:"
- $NGINXD 2 > /dev/ NULL $OPTIONS && Success || Failure
- RETVAL = $ ?
- [ "$RETVAL" = 0 ] && touch /var/lock/ Subsys/nginx
- Echo
- }
- Stop ()
- {
- Echo - N $ "shutting down $prog:"
- Killproc Nginx
- RETVAL = $ ?
- Echo
- [ $RETVAL -eq 0 ] && rm -F /var/Lock /subsys/nginx
- return $RETVAL
- }
- Reload ()
- {
- Echo - N $ "Reloading Nginx:"
- Killproc Nginx - HUP
- RETVAL = $ ?
- Echo
- return $RETVAL
- }
- Case "$" in
- "Start" )
- Start
- ;;
- "Stop" )
- Stop
- ;;
- "Restart" )
- Stop
- Start
- ;;
- "Reload" )
- Reload
- ;;
- "Status" )
- Status - p $PID _file nginx
- RETVAL = $ ?
- ;;
- *)
- echo $ "Usage: $ {start|stop|restart|reload|status}"
- RETVAL = 1
- Esac
- Exit $RETVAL
Save, add x permissions.
To start the boot:
Chkconfig Nginx on
Please support: http://www.webyang.net/Html/web/article_127.html
Linux Php+mysql+nginx Compilation and construction (I.)