一、安装httpd
成都创新互联是一家专注于网站建设、做网站与策划设计,赫章网站建设哪家好?成都创新互联做网站,专注于网站建设10年,网设计领域的专业建站公司;建站业务涵盖:赫章等地区。赫章做网站价格咨询:135182197921、安装apr
yum -y install gcc gcc-c++ openssl-devel pcre-devel tar xf apr-1.4.6.tar.bz2 cd apr-1.4.6 ./configure --prefix=/usr/local/apr --disable-ipv6 make && make install2、安装apr-util
tar xf apr-util-1.4.1.tar.bz2 cd apr-util-1.4.1 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr make && make install3、安装apache
tar zxf httpd-2.4.17.tar.gz cd httpd-2.4.17 ./configure \ --prefix=/usr/local/apache \ --sysconfdir=/etc/httpd \ --enable-so \ --enable-ssl \ --enable-cgi \ --enable-rewrite \ --with-zlib \ --with-pcre \ --with-apr=/usr/local/apr \ --with-apr-util=/usr/local/apr-util \ --enable-modules=most \ --enable-mods-shared=most \ --enable-mpms-shared=all \ --with-mpm=event make && make install4、设置服务控制脚本
cp build/rpm/httpd.init /etc/init.d/httpd vim /etc/init.d/httpd httpd=${HTTPD-/usr/local/apache/bin/httpd} pidfile=${PIDFILE-/usr/local/apache/logs/${prog}.pid} lockfile=${LOCKFILE-/var/lock/subsys/${prog}} RETVAL=0 # check for 1.3 configuration check13 () { CONFFILE=/etc/httpd/httpd.conf echo "PATH=/usr/local/apache/bin:$PATH" >> /etc/profile.d/http.sh . /etc/profile.d/http.sh ln -s /usr/local/apache/include/ /usr/include/httpd vim /etc/httpd/httpd.conf ServerName localhost:80 chkconfig --add httpd chkconfig httpd on service httpd start二、安装php
tar zxf php-5.6.0.tar.gz cd php-5.6.0 yum install -y libxml2 libxml2-devel bzip2 bzip2-devel curl* curl-devel libjpeg\* openjpeg\* \*png\* freetype\* ./configure \ --prefix=/usr/local/php \ --with-config-file-path=/usr/local/php/etc \ --with-bz2 \ --with-curl \ --enable-ftp \ --enable-sockets \ --disable-ipv6 \ --with-gd \ --with-jpeg-dir=/usr/local \ --with-png-dir=/usr/local \ --with-freetype-dir=/usr/local \ --enable-gd-native-ttf \ --with-iconv-dir=/usr/local \ --enable-mbstring \ --enable-calendar \ --with-gettext \ --with-libxml-dir=/usr/local \ --with-zlib \ --with-pdo-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-mysql=mysqlnd \ --enable-dom \ --enable-xml \ --enable-fpm \ --with-libdir=lib64 \ --enable-bcmath make make install cp php.ini-production /usr/local/php/etc/php.ini cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm chkconfig --add php-fpm chkconfig php-fpm on service php-fpm start三、整合httpd和php
方式1:修改httpd主配置文件httpd.conf
去掉以下两行的 ‘#’ LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so 修改ServerName ServerName 127.0.0.1:80 或 ServerName localhost:80 添加方式2:配置虚拟主机
去掉以下三行的 ‘#’ LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so Include /etc/httpd/extra/httpd-vhosts.conf 修改ServerName ServerName 127.0.0.1:80 或 ServerName localhost:80 注释下面正一行 DocumentRoot "/usr/local/apache/htdocs" 在httpd-vhosts.conf配置文件添加虚拟机四、测试
新建测试文件
vim /usr/local/nginx/html/phpinfo.php在浏览器中输入:http://ip/phpinfo.php
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。