无限星辰工作室-客户无限互联网动力之源

标题: Alibaba Cloud Linux 手动编译Nginx+php+mysql 记录 [打印本页]

作者: crx349    时间: 2023-6-2 23:14
标题: Alibaba Cloud Linux 手动编译Nginx+php+mysql 记录
先安装基础包
  1. yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel make  cmake bison-devel ncurses-devel libpng-devel libjpeg-devel curl-devel bzip2 bzip2-devel libxml2-devel freetype-devel openldap openldap-devel libxslt-devel
复制代码

1.安装nginx
  1. wget http://nginx.org/download/nginx-1.24.0.tar.gz

  2. wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
  3. tar -zvxf pcre-8.35.tar.gz
  4. cd pcre-8.35/
  5. ./configure
  6. make && make install

  7. tar zvxf nginx-1.24.0.tar.gz
  8. cd nginx-1.24.0/
  9. ./configure --prefix=/server/nginx --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-pcre=/home/xmspace.net/pcre-8.35
  10. make
  11. make install
  12. groupadd www
  13. useradd -g www www
  14. vi /server/nginx/conf/nginx.conf
复制代码


内容:

  1. user  www www;
  2. worker_processes  1;

  3. error_log  /server/log/nginx/error.log crit;
  4. pid        /server/nginx/logs/nginx.pid;

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

  7. events
  8. {
  9.   use epoll;
  10.   worker_connections 65535;
  11. }


  12. http {
  13.         include       mime.types;
  14.         default_type  application/octet-stream;

  15.         #charset  gb2312;

  16.         server_names_hash_bucket_size 128;
  17.         client_header_buffer_size 32k;
  18.         large_client_header_buffers 4 32k;
  19.         client_max_body_size 50m;

  20.         sendfile on;
  21.         tcp_nopush     on;

  22.         keepalive_timeout 600;

  23.         tcp_nodelay on;

  24.         fastcgi_connect_timeout 300;
  25.         fastcgi_send_timeout 300;
  26.         fastcgi_read_timeout 300;
  27.         fastcgi_buffer_size 64k;
  28.         fastcgi_buffers 4 64k;
  29.         fastcgi_busy_buffers_size 128k;
  30.         fastcgi_temp_file_write_size 128k;

  31.         gzip on;
  32.         gzip_min_length  1k;
  33.         gzip_buffers     4 16k;
  34.         gzip_http_version 1.0;
  35.         gzip_comp_level 2;
  36.         gzip_types       text/plain application/x-javascript text/css application/xml;
  37.         gzip_vary on;
  38.         #limit_zone  crawler  $binary_remote_addr  10m;
  39.         log_format '$remote_addr - $remote_user [$time_local] "$request" '
  40.                       '$status $body_bytes_sent "$http_referer" '
  41.                       '"$http_user_agent" "$http_x_forwarded_for"';
  42.         include /server/nginx/conf/vhosts/*.conf;
  43.         include /server/nginx/conf/vhosts/website/*.conf;
  44.         
  45. }
复制代码


自启动:
  1. vi /etc/init.d/nginx
复制代码


内容:
  1. # nginx Startup script for the Nginx HTTP Server
  2. # chkconfig: - 85 15
  3. # this script create it by crx349. at 2023.06.02
  4. # xmspace.net

  5. nginxd=/server/nginx/sbin/nginx
  6. nginx_config=/server/nginx/conf/nginx.conf
  7. nginx_pid=/server/nginx/logs/nginx.pid

  8. RETVAL=0
  9. prog="nginx"

  10. [ -x $nginxd ] || exit 0

  11. # Start nginx daemons functions.
  12. start() {
  13.    
  14.     if [ -e $nginx_pid ] && netstat -tunpl | grep nginx &> /dev/null;then
  15.         echo "nginx already running...."
  16.         exit 1
  17.     fi
  18.         
  19.     echo -n $"Starting $prog!"
  20.     $nginxd -c ${nginx_config}
  21.     RETVAL=$?
  22.     echo
  23.     [ $RETVAL = 0 ] && touch /var/lock/nginx
  24.     return $RETVAL
  25. }


  26. # Stop nginx daemons functions.
  27. stop() {
  28.     echo -n $"Stopping $prog!"
  29.     $nginxd -s stop
  30.     RETVAL=$?
  31.     echo
  32.     [ $RETVAL = 0 ] && rm -f /var/lock/nginx
  33. }


  34. # reload nginx service functions.
  35. reload() {

  36.     echo -n $"Reloading $prog!"
  37.     #kill -HUP `cat ${nginx_pid}`
  38.     $nginxd -s reload
  39.     RETVAL=$?
  40.     echo

  41. }

  42. # See how we were called.
  43. case "$1" in
  44. start)
  45.         start
  46.         ;;

  47. stop)
  48.         stop
  49.         ;;

  50. reload)
  51.         reload
  52.         ;;

  53. restart)
  54.         stop
  55.         start
  56.         ;;

  57. *)
  58.         echo $"Usage: $prog {start|stop|restart|reload|help}"
  59.         exit 1
  60. esac

  61. exit $RETVAL
复制代码


执行权限:
  1. chmod +x /etc/init.d/nginx
  2. chkconfig  --add nginx
  3. chkconfig nginx on
  4. service nginx start #启动
  5. /server/nginx/sbin/nginx -t
复制代码


正常:
  1. nginx: the configuration file /server/nginx/conf/nginx.conf syntax is ok
  2. nginx: configuration file /server/nginx/conf/nginx.conf test is successful
复制代码


2.安装php 7.2.34






欢迎光临 无限星辰工作室-客户无限互联网动力之源 (https://xmspace.net/) Powered by Discuz! X3.4