LANP架构搭建

5 篇文章 0 订阅
2 篇文章 0 订阅

安装Apache

  1. 解压apache安装包(httpd-2.4.17.tar.gz)到 /usr/src/目录下面

tar -zxvf /root/httpd-2.4.17.tar.gz -C /usr/src/
  1. 安装httpd所需要的依赖包

yum -y install zlib* openssl* apr* pcre-devel openssl*
  1. 进入httpd目录,安装httpd所需要的模块

./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi --enable-mpms-shared=all --with-mpm=worker --enable-cgid --enable-deflate --enable-ssl --enable-modules=most --enable-modes-shared=most
  1. 编译安装,并嵌入系统内核

make && make install
  1. 制作路径优化(注意:*号前面没有空格)

ln -s /usr/local/httpd/bin/* /usr/local/bin/
  1. 将文本复制到/etc/init.d目录下起名为httpd

cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
  1. 在httpd添加配置服务识别参数

vim /etc/init.d/httpd 

在第二行#号后面添加:chkconfig:35 33 33

  1. 将httpd添加为系统服务

chkconfig --add httpd
chkconfig httpd on
  1. 重启httpd

systemctl restart httpd

安装PHP

  1. 安装lib开发库

yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp gmp-devel expat-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel libcurl libcurl-devel curl curl-devel libmcrypt libmcrypt-devel libxslt libxslt-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmemcached-devel libzip readline readline-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
  1. 上传并解压php安装包(php-5.5.9.tar.bz2)

cd /root
tar -xjf php-5.5.9.tar.bz2
  1. 生成configure文件

#分别进入以下文件夹
cd /root/php-5.5.9/ext/curl
cd /root/php-5.5.9/ext/fileinfo
cd /root/php-5.5.9/ext/gd
cd /root/php-5.5.9/ext/ldap
cd /root/php-5.5.9/ext/mbstring
cd /root/php-5.5.9/ext/mysql
cd /root/php-5.5.9/ext/mysqli
cd /root/php-5.5.9/ext/openssl(额外执行mv config0.m4 config.m4)
cd /root/php-5.5.9/ext/pdo_mysql
cd /root/php-5.5.9/ext/pdo_sqlite
cd /root/php-5.5.9/ext/soap
cd /root/php-5.5.9/ext/sockets
#执行
/root/php-5.5.9/bin/phpize
  1. 编译

cd /root/php-5.5.9
./configure --prefix=/root/php-5.5.9 --with-config-file-path=/root/php-5.5.9/etc --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/root --with-png-dir=/root --with-freetype-dir=/root --enable-gd-native-ttf --with-iconv-dir=/root --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/root --with-zlib --with-pdo-mysql=mysqlnd --with-openssl --with-mysqli=mysqlnd --with-mysql=mysqlnd --with-apxs2=/usr/local/httpd/bin/apxs  --enable-dom --enable-xml --enable-fpm --with-php-config=/root/php-5.5.9/bin/php-config
  1. 安装

make && make install

报错就用make clean清除

  1. 初始化配置文件php.ini

cp /root/php-5.5.9/php.ini-production /root/php-5.5.9/etc/php.ini
  1. 初始化配置文件php-fpm.conf

cp /root/php-5.5.9/etc/php-fpm.conf.default /root/php-5.5.9/etc/php-fpm.conf
  1. 启动php

/root/php-5.5.9/sbin/php-fpm

Apache配置

配置httpd.conf,使其能解析php文件

找到AddType application/x-gzip .gz .tgz,在后面添加AddType application/x-httpd-php .php

修改DirectoryIndex index.html为DirectoryIndex index.html index.htm index.php

修改ServerName www.example.com:80为ServerName localhost:80

PHP配置

配置php.ini

开启扩展包,去掉以下语句前面的【;】

extension=php_curl.dll

extension=php_fileinfo.dll

extension=php_gd2.dll

extension=php_ldap.dll

extension=php_mbstring.dll

extension=php_mysql.dll

extension=php_mysqli.dll

extension=php_openssl.dll

extension=php_pdo_mysql.dll

extension=php_pdo_sqlite.dll

extension=php_soap.dll

extension=php_sockets.dll

附录

将php添加到系统服务

cp  /root/php-5.5.9/sapi/fpm/init.d.php-fpm  /etc/init.d/php-fpm
chmod 755 /etc/init.d/php-fpm

php命令

service php-fpm start   #开启
service php-fpm stop    #停止
service php-fpm restart #重启
service php-fpm status  #状态

查看apache根目录

在httpd.conf中搜索DocumentRoot

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值