摘要:系统版本 [root@vCentos ~]# lsb_release -a LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-no
[root@vCentos ~]# lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.5 (Final)
Release: 6.5
Codename: Final
[root@vCentos ~]#
1.更新系统到最新的版本
[root@vCentos ~]# yum -y update
2. 安装apache、mysql、php
yum -y install httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-mcrypt php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc mysql-connector-odbc mysql-devel libdbi-dbd-mysql
3.启动apache 和 mysqlservice httpd start
service mysqld start
4.设置apache , mysql 自启动chkconfig httpd on
chkconfig mysqld on
5. 修改iptables的配置文件:[root@vCentos ~]#vim /etc/sysconfig/iptables
增加80、2373端口的开放:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 2373 -j ACCEPT
然后保存并退出。
6.修改httpd的配置文件vim /etc/httpd/conf/httpd.conf
添加开放端口2373
#Listen 12.34.56.78:80 Listen 80 Listen 2373 #添加开放端口
并且在最后面添加虚拟主机,并分别指定端口80 和2373,然后保存
<VirtualHost *:80> # ServerAdmin webmaster@dummy-host.example.com DocumentRoot /var/www/80 ServerName 172.24.3.100:80 # ErrorLog logs/dummy-host.example.com-error_log # CustomLog logs/dummy-host.example.com-access_log common </VirtualHost> # <VirtualHost *:2373> # ServerAdmin webmaster@dummy-host.example.com DocumentRoot /var/www/2373 ServerName 172.24.3.100:81 # ErrorLog logs/dummy-host.example.com-error_log # CustomLog logs/dummy-host.example.com-access_log common </VirtualHost> 7.在/var/www/下新建虚拟主机的目录
mkdir 80 mkdir 2373 8.在重启的httpd的服务时发生如下错误:
(13)Permission denied: make_sock: could not bind to address [::]:2373
发现应该是 SELinux 安全机制的作用
参考文章:
http://blog.csdn.net/maoxiang/article/details/5720464
但是发现semanage在我的主机中无法使用
semanage SELinux Command Not Found
参考文章:
http://blog.csdn.net/chencong112/article/details/6973169
于是
# yum whatprovides /usr/sbin/semanage # yum -y install policycoreutils-python
查看下预定义
#semanage port -l http_cache_port_t tcp 3128, 8080, 8118, 11211, 10001-10010 http_cache_port_t udp 3130, 11211 http_port_t tcp 80, 443, 488, 8008, 8009, 8443 soundd_port_t tcp8000, 9433, 16001
http中没有2373这个端口 增加个端口
semanage port -a -t http_port_t -p tcp 2373
完成以上这些步骤,就apache服务器就正常了
相关文章推荐
虚拟主机的专业参数,分别都是什么意思?2022-09-09
中非域名注册规则是怎样的?注册域名有什么用处? 2022-01-10
HostEase新年活动促销 美国/香港主机全场低至五折2021-12-28
HostGator下载完整备份教程分享2021-12-28
Flink中有界数据与无界数据的示例分析2021-12-28