找回密码
 立即注册

QQ登录

只需一步,快速开始

Alibaba Cloud Linux 手动编译Nginx+php+mysql 记录

[点击打赏获取Alibaba Cloud Linux下Lnmp手动编译教程]
先安装基础包
  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
游客,如果您要查看本帖隐藏内容请回复


本教程由无限星辰工作室CRX349独家整理和提供,转载请注明地址,谢谢。本文地址:https://www.xmspace.net/thread-976-1-1.html
无限星辰工作室  好集导航 Discuz全集下载  星辰站长网  集热爱361  一品文学  手机小游戏合集   海外空间网 星辰api  星辰支付二维码管理平台 阿里云服务器 腾讯云服务器
服务Discuz!建站|DiscuzQ配置|二开|小程序|APP|搬家|挂马清理|防护|Win/Linux环境搭建|优化|运维|
服务理念:专业 诚信 友好QQ842062626 服务项目 Q群315524225

发表于 2023-6-2 23:14:18 | 显示全部楼层 |阅读模式

回复 | 使用道具 举报

该帖共收到 0 条回复!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

美图秀

    • fastadmin 后台界面使用字段数组类型
    • Discuz!x3.5 修改标题高亮颜色
    • Discuz!x3.5 应用中心 下载应用一直下载中
    • 帖子定时显示
    • 论坛辅助审核
拖动客服框
Online Service
点击这里给我发消息
点击这里联系我们
微信扫一扫
在线客服
快速回复 返回顶部 返回列表