网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 服务器与数据库 > 服务器环境搭建
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

服务器环境搭建 Windows,Linux,IIS,Apache等服务器配置、安全维护以及PHP和MYSQL运行环境讨论。

Reply
 
Thread Tools Display Modes
  #1   IP: 106.111.142.4
Old 2016-06-07, 04:22 PM
Cherryville Cherryville is offline
初级会员
 
Join Date: 2006-03-06
Posts: 1
Cherryville 现在声名狼藉
Default centos7.0卸载系统默认版本,安装apache-2.4.10及其出现问题

centos7.0安装完毕后,通过yum 安装的apache版本是 2.4.6的。

于是先停止了httpd服务,然后卸载了默认安装的版本。

systemctl stop httpd.service
rpm -qa|grep httpd #查看apache包,找到名字(例如httpd-2.4.6-18.el6_2.1.x86_64)后用下面命令删除
rpm -e httpd-2.2.15-15.el6_2.1.x86_64 #不过要先把依赖apache的包删除
或者
yum remove httpd
yum list|grep httpd #查看apache包名,例如httpd.x86_64
yum erase httpd.x86_64 #相关依赖包自动会被删除
开始安装2.4.10
wgethttp://mirrors.cnnic.cn/apache/httpd/httpd-2.4.10.tar.gz
wget http://apache.dataguru.cn/apr/apr-1.5.1.tar.gz
wget http://apache.dataguru.cn/apr/apr-util-1.5.3.tar.gz
cd apr-1.5.1
./configure --prefix=/usr/local/apr
Make
Make install
cd apr-util-1.5.3
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
Make
Make install
Cd /usr/local/src
Tar –xvf httpd-2.4.10.tar.gz
./configure --prefix=/usr/local/apache--sysconfdir=/etc/httpd2 --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-mpms-shared=all --with-mpm=event --enable-proxy
--enable-proxy-fcgi
# 参数依次是: httpd安装路径 httpd配置文件存放路径 启用模块化方式 启用ssl安全连接
# 启用cgi脚本功能 启用url重写 启用服务器压缩 启用正则表达式支持 apr安装路径
# apr util安装路径 启用常用模块以确保apache正常工作 将多进程模型非静态化
# 启用事件异步模型
Make
Make install
装完后,配置httpd.conf文件,我make的时候出了点小差错,这个文件的路径装的位置过深,于是用ln命令链接到一个比较好找的位置
ln -s /usr/local/apache/bin/httpd2/conf /usr/local/conf
vi /usr/local/conf/httpd.conf
#AddHandler cgi-script .cgi #修改为:AddHandler cgi-script .cgi .pl (允许扩展名为.pl的CGI脚本运行)
AllowOverride None  #修改为:AllowOverride All (允许.htaccess)
AddDefaultCharset UTF-8 #修改为:AddDefaultCharset GB2312 (添加GB2312为默认编码)
#Options Indexes FollowSymLinks #修改为 Options FollowSymLinks(不在浏览器上显示树状目录结构)
DirectoryIndex index.html #修改为:DirectoryIndex index.html index.htm Default.html Default.htmindex.php(设置默认首页文件,增加index.php)
servername 名字改好
保存退出,运行 systemctl start httpd.service 启动httpd服务,运行netstat -tnl 和 netstat -ntpl |grep 80 发现服务没起来。
运行/usr/local/apache/bin/apachectl start 一样没启动
运行/usr/local/apache/bin/apachectl stop 报错 服务没启动,no httpd.pid
于是cat /usr/local/apache/logs/error_log
H01177: Failed to lookup provider 'shm' for 'slotmem': is mod_slotmem_shm loaded??
grep 'slotmem' /usr/local/conf/httpd.conf
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
/usr/local/apache/bin/apachectl -k start
netstat -ntpl |grep :80
tcp 0 0 :::80 :::* LISTEN 7898/httpd
测试apache IT IS WORK.
这个版本的apache配置虚拟主机,来配置文件放到了conf/extra/下面,conf/extra/httpd-vhosts.conf
打开httpd.conf: 将#Include conf/extra/httpd-vhosts.conf 前的“#”去掉 让apache加载虚拟机配置文件
打开conf/extra/httpd-vhosts.conf,隐掉或删掉例子
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host2.example.com
# DocumentRoot "/usr/local/apache2/docs/dummy-host2.example.com"
# ServerName dummy-host2.example.com
# ErrorLog "logs/dummy-host2.example.com-error_log"
# CustomLog "logs/dummy-host2.example.com-access_log" common
#</VirtualHost>
添加自己的修改过的配置
注意要加上权限
<Directory />
Options Indexes FollowSymLinks
AllowOverride all
require all granted
</Directory>
安装PHP
wget http://cn2.php.net/get/php-5.5.17.tar.gz/from/this/mirror

yum install libxml2-devel gd-devel libmcrypt-devel libcurl-devel openssl-devel
./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache/bin/apxs --enable-shared --with-libxml-dir --with-gd --with-openssl --enable-mbstring --with-mcrypt --with-mysqli --with-mysql --enable-opcache --enable-mysqlnd --enable-zip --with-zlib-dir --with-pdo-mysql --with-jpeg-dir --with-freetype-dir --with-curl --without-pdo-sqlite --without-sqlite3
载入php的模组

LoadModule php5_module modules/libphp5.so

AddType application/x-httpd-php .php .php3 .php5 .phtml (注意:php .php这个点前面有一个空格)

在/var/www/html 目录新建 index.php 输入下面内容
<?php
phpinfo();
?>
访问页面测试PHP是否成功
安装PHPWIND
用winscp将PHPWIND源文件复制到服务器上
配置虚拟站点
Vi /usr/local/conf/extra/httpd-vhosts.conf
配置一个域名
PHPWIND有些目录(具体名字略)需要读写权限,可以用winscp设置权限,也可以命令行
Chomd o+w data
安装配置phpadmin
安装略
cd phpdmin
chmod -R 777 phpMyAdmin
cp config.sample.inc.php config.inc.php
vi config.inc.php
vi config.inc.php修改以下的参数为:(如果没有,可自己添加)
$cfg['Servers'][$i]['auth_type'] = 'config';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '??';
'auth_type' 用于设置登陆方式,config是直接从这个文件中获取user/password然后连接数据库,http则是在客户端访问的时候会弹出一个输入用户名密码的框进行认证处理 cookie则是通过页面输入用户名密码进行连接。其中config的安全等级最低,cookie的等级最高,不过如果禁用了cookie则无法使用cookie的方式进行认证。
配置apache配置文件:/usr/local/apache/conf/extra/httpd-vhost.conf
添加:
<VirtualHost xxx:80>
ServerAdmin xxx
DocumentRoot "/usr/local/apache/htdocs/phpMyAdmin"
ServerName xxx
ErrorLog "logs/mysql.admin-error_log"
CustomLog "logs/mysql.admin-access_log" common
</VirtualHost>
9. 重新启动apache服务
配置好hosts后,就可以通过http:// 域名来访问了。

make
  根据Makefile文件编译源代码、连接、生成目标文件、可执行文件。
  make clean
  清除上次的make命令所产生的object文件(后缀为“.o”的文件)及可执行文件。
  make install
  将编译成功的可执行文件安装到系统目录中,一般为/usr/local/bin目录。
  make dist
  产生发布软件包文件(即distribution package)。这个命令将会将可执行文件及相关文件打包成一个tar.gz压缩的文件用来作为发布软件的软件包。
  它会在当前目录下生成一个名字类似“PACKAGE-VERSION.tar.gz”的文件。PACKAGE和VERSION,是我们在configure.in中定义的AM_INIT_AUTOMAKE(PACKAGE, VERSION)。
  make distcheck
  生成发布软件包并对其进行测试检查,以确定发布包的正确性。这个操作将自动把压缩包文件解开,然后执行configure命令,并且执行make,来确认编译不出现错误,最后提示你软件包已经准备好,可以发布了。
  make distclean
  类似make clean,但同时也将configure生成的文件全部删除掉,包括Makefile文件。
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 10:56 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.