分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 运营维护

httpd 的坑

发布时间:2023-09-06 02:11责任编辑:苏小强关键词:http

Httpd服务器的坑

  1. 在/etc/httpd/conf/httpd.conf中的配置信息, 有时注释到的内容仍然会生效
  2. 配置Auth时, 允许htpasswd规定的文件中的所有的用户, Require valid-uesr, 允许特定的用户Require user user1 user2 user3 ...
  3. 允许组, Require group group1 group2

在CentOS6中安装httpd2.4

1. 前提条件:

 ???- Development tools<br> ???- Server Platform tools<br> ???- apr-1.5+<br> ???- apr-util-1.5+<br> ???- httpd-2.4<br> ???- expat-devel<br> ???- openssl-devel<br> ???- prec-devel<br> ???- httpd2.2(需要其httpd2.2的服务配置, 提供httpd2.4服务配置模板)

2. 操作:

 ???1. 解压apr之后, .configure --prefix=/usr/local/apr; make && make install ???2. 解压apr-util之后, .configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr; make && make install ???3. 解压httpd2.4, ????????./configure --prefix=/usr/local/httpd24 --sysconfdir=/etc/httpd24 --enable-so ?--enable-ssl --enable-cgi ?--enable-rewrite ?--with-zlib ?--with-pcre=/usr/local/pcre ?--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util ?--enable-modules=most ?--enable-mpms-shared=all --with-mpm=event ???????4. 复制脚本, cp /etc/rc.d/init.d/httpd /etc/rc.d/init.d/httpd24<br> ???????**注意**:单纯的复制服务脚本是不行的, 我们还要根据具体的情况进行修改 ???5. 添加服务脚本, chkconfig --add httpd24 ???6. 启动httpd, service httpd start ???7. 导出man, 库文件(.so), 头文件, 系统的环境变量 ???8. 查看/var/run/httpd/httpd.pid的内容, 启动httpd服务会以该文件中定义的pid进行运行 ???9. 加载相应的模块 ???????proxy_module和fcgi有关的 ???10. 关闭正向代理

CentOS6上编译安装php(先安装apr, apr-util, httpd, mariab, zlib2-devel, libmcrypt-devel, libxml2-devel, httpd-devel)

1. 解压php包2. 命令参数 

./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/usr/local/httpd24/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts

3. make && make install

4. 此时会在/etc/httpd24/httpd.conf中多出LoadModule php的信息

5. 为了能让httpd解析php文件, 在配置文件中添加

AddType application/x-httpd-php .php

AddType application/x-httpd-ph-source .phps

Directory Index index.php index.html

6. 我们编译安装的httpd的docroot是在/usr/localhttpd24/htdoc中, 在这里index.php进行测试即可

7. 为了加开运行, 编译安装xcache

解压

进入到解压目录

/usr/local/php/bin/phpize: 用于生成configure文件

./configure --enable-xcache --enable-xcache-coverager --enable-xcache-optimizer --with-php-config=/usr/local/php/bin/php-config

make && make install

创建/etc/php.d文件夹,将xcache.ini配置文件复制到此文件,以便php读取加载。



8. 这里使用的php安装时编译在httpd中(成为httpd的一个模块的, 所以配置时 需要指明httpd的相关位置), 而安装采用fpm则不需要, 但是因为php与mysql有关, 所以还是需要mysql的位置的配置信息

httpd 的坑

原文地址:https://www.cnblogs.com/megachen/p/9504773.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved