Linux Php+mysql+nginx Compilation and construction (I.)

Source: Internet
Author: User
Tags openssl nginx server

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:

  
 
  1. 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:

 
   
  
  1. / opt /

Download and unzip:

 
   
  
  1. wget http : //nginx.org/download/nginx-1.5.2.tar.gz
  2. - zxf Nginx - 1.5 . 2.tar . GZ
  3. wget http : //labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz
  4. - zxf Ngx_cache_purge - 2.1 . Tar . GZ

Enter the directory and compile:

  
 
  1. CD Nginx - 1.5 . 2
  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
  3. 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:

 
   
  
  1. - F www
  2. - 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

  
 
  1. #!/bin/bash
  2. #
  3. # Init file for Nginx server daemon
  4. #
  5. # chkconfig:234 99 99
  6. # Description:nginx Server Daemon
  7. #
  8. # source Function Library
  9. . /etc/RC. D / Init . D / functions
  10. # Pull in Sysconfig settings
  11. [ -F /etc/sysconfig/Nginx ] && . /etc/sysconfig/nginx
  12. RETVAL = 0
  13. Prog = "Nginx"
  14. PAT = /usr/ Local / Nginx
  15. Nginxd = /usr/ Local / Nginx / Sbin / Nginx
  16. Pid_file = /usr/ Local / Nginx / Nginx . PID
  17. Start ()
  18. {
  19. Echo - N $ "Starting $prog:"
  20. $NGINXD 2 > /dev/ NULL $OPTIONS && Success || Failure
  21. RETVAL = $ ?
  22. [ "$RETVAL" = 0 ] && touch /var/lock/ Subsys/nginx
  23. Echo
  24. }
  25. Stop ()
  26. {
  27. Echo - N $ "shutting down $prog:"
  28. Killproc Nginx
  29. RETVAL = $ ?
  30. Echo
  31. [ $RETVAL -eq 0 ] && rm -F /var/Lock /subsys/nginx
  32. return $RETVAL
  33. }
  34. Reload ()
  35. {
  36. Echo - N $ "Reloading Nginx:"
  37. Killproc Nginx - HUP
  38. RETVAL = $ ?
  39. Echo
  40. return $RETVAL
  41. }
  42. Case "$" in
  43. "Start" )
  44. Start
  45. ;;
  46. "Stop" )
  47. Stop
  48. ;;
  49. "Restart" )
  50. Stop
  51. Start
  52. ;;
  53. "Reload" )
  54. Reload
  55. ;;
  56. "Status" )
  57. Status - p $PID _file nginx
  58. RETVAL = $ ?
  59. ;;
  60. *)
  61. echo $ "Usage: $ {start|stop|restart|reload|status}"
  62. RETVAL = 1
  63. Esac
  64. 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.)

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.