最近买了云主机,准备挂小说站点。但是很多小说站点的站长都是用的Windows环境,所以写一篇Linux服务器的小说站点。主要是为了节约成本,Windows的配置都相对要高一些。服务器采用centos6
一、安装Apache
1、安装httpd
[root@localhost ~]# yum install httpd
2、让httpd跟随系统启动
[root@localhost ~]# chkconfig --levels 235 httpd on
3、由于 CentOS 已经封装了Apache,所以直接启动
[root@localhost ~]# /etc/init.d/httpd start
4、访问你的主机地址,正常情况下能够看到 “Apache 2 Test Page powered by CentOS” 的测试页面。
5、如果远程无法显示这个页面,而本机可以访问的话,一般情况下是 CentOS 自带的防火墙禁止了。下面有介绍怎么开启相应的端口。
6、注意:在 CentOS 中 Apache 的默认根目录是 /var/www/html,配置文件 /etc/httpd/conf/httpd.conf。其他配置存储在 /etc/httpd/conf.d/ 目录。
二、开启需要使用的端口
1、关掉防火墙
[root@localhost ~]# /etc/rc.d/init.d/iptables stop
2、编辑防火墙规则
[root@localhost ~]# vim /etc/sysconfig/iptables
开启如下端口:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT