获取ngnix,apache,php,mysql的编译参数 zz from xi4oyu

本文将展示如何通过命令行查看Nginx、Apache、MySQL、PHP的编译参数,包括配置选项和依赖库。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

有时候nginx,apache,mysql,php编译完了想看看编译参数可以用以下方法 nginx编译参数: #/usr/local/nginx/sbin/nginx -V nginx version: nginx/0.6.32 built by gcc 4.1.2 20071124 (Red Hat 4.1.2-42) configure arguments: –user=www –group=www –prefix=/usr/local/nginx/ –with-http_stub_status_module –with-openssl=/usr/local/openssl apache编译参数: # cat /usr/local/apache2/build/config.nice #! /bin/sh # # Created by configure “./configure” / “–prefix=/usr/local/apache2″ / “–with-included-apr” / “–enable-so” / “–enable-deflate=shared” / “–enable-expires=shared” / “–enable-rewrite=shared” / “–enable-static-support” / “–disable-userdir” / “$@” php编译参数: # /usr/local/php/bin/php -i |grep configure Configure Command => ‘./configure’ ‘–prefix=/usr/local/php’ ‘–with-apxs2=/usr/local/apache2/bin/apxs’ ‘–with-config-file-path=/usr/local/php/etc’ ‘–with-mysql=/usr/local/mysql’ ‘–with-libxml-dir=/usr/local/libxml2/bin’ ‘–with-gd=/usr/local/gd2′ ‘–with-jpeg-dir’ ‘–with-png-dir’ ‘–with-bz2′ ‘–with-xmlrpc’ ‘–with-freetype-dir’ ‘–with-zlib-dir’ mysql编译参数: # cat “/usr/local/mysql/bin/mysqlbug”|grep configure # This is set by configure CONFIGURE_LINE=”./configure ‘–prefix=/usr/local/mysql’ ‘–localstatedir=/var/lib/mysql’ ‘–with-comment=Source’ ‘–with-server-suffix=-H863′ ‘–with-mysqld-user=mysql’ ‘–without-debug’ ‘–with-big-tables’ ‘–with-charset=gbk’ ‘–with-collation=gbk_chinese_ci’ ‘–with-extra-charsets=all’ ‘–with-pthread’ ‘–enable-static’ ‘–enable-thread-safe-client’ ‘–with-client-ldflags=-all-static’ ‘–with-mysqld-ldflags=-all-static’ ‘–enable-assembler’ ‘–without-isam’ ‘–without-innodb’ ‘–without-ndb-debug’”
### 宝塔面板中同时安装和配置 Nginx 和 Apache 的教程 #### 1. 准备工作 在开始之前,确保已经成功安装了宝塔面板。如果尚未完成安装,可以按照官方文档中的命令执行一键部署脚本[^3]。 ```bash wget -O install_panel.sh http://download.bt.cn/install/install_6.0.sh && bash install_panel.sh ed8484bec ``` #### 2. 默认设置调整 由于宝塔面板默认不支持 Nginx 和 Apache 同时运行,因此需要手动修改部分配置文件来实现两者的共存[^1]。 - **禁用默认冲突检测** 登录到宝塔面板后台,在 `软件商店` 中分别安装 Nginx 和 Apache。注意不要启用自动启动功能,因为这可能会引发端口占用问题。 #### 3. 配置 Nginx 转发至 Apache 为了使两者能够协同工作,通常的做法是让 Nginx 处理前端请求并将特定流量反向代理给 Apache 进行处理[^2]。 - 编辑 Nginx 配置文件 `/www/server/nginx/conf/nginx.conf` 或者对应站点的虚拟主机配置文件。 ```nginx server { listen 80; server_name yourdomain.com; location / { proxy_pass http://127.0.0.1:8080; # 将请求转发到 Apache 监听的端口 proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } ``` 上述代码片段定义了一个简单的反向代理规则,其中所有的 HTTP 请求都会被重定向到本地地址上的 Apache 实例。 #### 4. 设置 Apache 监听其他端口 为了避免与 Nginx 发生端口冲突,默认情况下应更改 Apache 使用的端口号(例如从标准的 80 改为 8080)。编辑 Apache 主配置文件 `/www/server/apache/conf/httpd.conf` 并找到如下行: ```apache Listen 80 ``` 将其替换为新的监听端口: ```apache Listen 8080 ``` 保存后重启服务以应用更改。 #### 5. SSL 证书管理 当涉及 HTTPS 协议时,需特别小心地配置 SSL 证书以防发生错误。对于 Apache 来说,务必按指定顺序上传证书内容——先输入公钥再粘贴完整的证书链;而对于 Nginx,则只需提供单独的 `.crt` 文件即可[^4]。 --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值