linux怎么linux 启动apache服务e

mysql(22)
apache(2)
linux开启启动的程序一般放在/etc/rc.d/init.d/里面,/etc/init.d/是其软连接
mysql设为linux服务
cp /usr/local/mysql5/share/mysql/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 2345 mysqld on
chown mysql:mysql -R /usr/local/mysql5/
service mysqld start
apache设为linux服务
cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
vi /etc/init.d/httpd
在在#!/bin/sh后面加入下面两行
#chkconfig:345 85 15
#description: Start and stops the Apache HTTP Server.
chmod +x /etc/rc.d/init.d/httpd
chkconfig --add httpd
然后可以用setup命令进入服务设置,设置为开机启动
第二种方法:
在/etc/rc.d/rc.local中增加启动apache的命令,例如:/usr/local/httpd/bin/apachectl start
转载地址:
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:71942次
积分:1799
积分:1799
排名:千里之外
原创:98篇
转载:71篇
(4)(16)(16)(6)(8)(13)(18)(10)(2)(5)(7)(12)(9)(3)(25)(2)(1)(3)(2)(4)(7)
(window.slotbydup = window.slotbydup || []).push({
id: '4740881',
container: s,
size: '200,200',
display: 'inlay-fix'linux&下&apache启动、停止、重启命令
基本的操作方法:
本文假设你的apahce安装目录为/usr/local/apache2,这些方法适合任何情况
apahce启动命令:
推荐/usr/local/apache2/bin/apachectl start apaceh启动
apache停止命令
/usr/local/apache2/bin/apachectl
stop&& 停止
apache重新启动命令:
/usr/local/apache2/bin/apachectl restart 重启
要在重启 Apache 服务器时不中断当前的连接,则应运行:
/usr/local/sbin/apachectl graceful
如果apache安装成为linux的服务的话,可以用以下命令操作:
service httpd start 启动
service httpd restart 重新启动
service httpd stop 停止服务
Linux系统为Ubuntu
一、Start Apache 2 Server
/启动apache服务
# /etc/init.d/apache2 start
$ sudo /etc/init.d/apache2 start
二、 Restart Apache 2 Server
/重启apache服务
# /etc/init.d/apache2 restart
$ sudo /etc/init.d/apache2 restart
三、Stop Apache 2 Server
/停止apache服务
# /etc/init.d/apache2 stop
$ sudo /etc/init.d/apache2 stop
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。-----使用技术手段解决问题,坚信注重每一个细节,把熟悉的做到一种极致,一定会有创新出现。-----
上一个博客中,记录了在Linux下安装、启动mysql,地址:http://blog.csdn.net/wy3552128/article/details/8143686
平台:VMware上虚拟的centos4.7
宿主机:windows
安装Apache前准备:
1、检查该环境中是否已经存在httpd服务的配置文件,默认存储路径:/etc/httpd/httpd.conf(这是centos预装的Apache的一个ent版本,一般我们安装源代码版的Apache)。如果已经存在/etc/httpd/httpd.conf,请先卸载或者关闭centos系统自带的web服务,执行命令:chkconfig
&httpd off,再或者把centos自带的httpd服务的80端口改为其他端口,只要不与我们安装的Apache服务的端口冲突就可以啦。
停止并卸载Linux系统自带的httpd服务:
1、service httpd stop
2、ps -ef | grep httpd
3、kill -9 pid号(逐个删除)
4、rpm -qa |grep
-e httpd软件包
[root@localhost bin]# find / -name httpd.conf
[root@localhost bin]#
2、下载Apache安装包(httpd-2.4.3.tar.gz或httpd-2.2.23.tar.gz),下载地址:http://httpd.apache.org/在安装Apache时,我分别针对不同版本进行了安装,在编译时是不同的,configure后跟的参数不同。
httpd-2.2.23版本编译命令:
./configure --prefix=/usr/local/apache2 (安装目录参数后面可以不加任何参数,直接安装即可)
make install
httpd-2.4.3版本编译命令:
./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre (除了指定Apache的安装目录外,还要安装apr、apr-util、pcre,并指定参数)
make install
在编译Apache(在安装httpd-2.4.3时遇到的问题)时分别出现了apr not found、APR-util not found、pcre-config for libpcre not found的问题,下面就httpd-2.4.3的这些问题解决来实际操作一把。
http://apr.apache.org/download.cgi &下载apr-1.4.5.tar.gz、apr-util-1.3.12.tar.gz
http://sourceforge.net/projects/pcre/files/latest/download 下载pcre-8.31.zip
1.解决apr not found问题
[root@localhost bin]# tar -zxf apr-1.4.5.tar.gz
[root@localhost apr-1.4.5]# ./configure --prefix=/usr/local/apr
[root@localhost apr-1.4.5]# make
[root@localhost apr-1.4.5]# make install
2.解决APR-util not found问题
[root@localhost bin]# tar -zxf apr-util-1.3.12.tar.gz
[root@localhost apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config
[root@localhost apr-util-1.3.12]# make
[root@localhost apr-util-1.3.12]# make install
3、解决pcre-config for libpcre not found问题
[root@localhost ~]# unzip pcre-8.31.zip
[root@localhost ~]# cd pcre-8.31
[root@localhost pcre-8.31]# ./configure --prefix=/usr/local/pcre
[root@localhost pcre-8.31]# make[root@localhost pcre-8.31]# make install
如果已经存在/etc/httpd/httpd.conf,请先卸载或者关闭centos系统自带的web服务,执行命令:chkconfig &httpd off,再或者把centos自带的httpd服务的80端口改为其他端口,只要不与我们安装的Apache服务的端口冲突就可以啦。
&启动Apache:/usr/local/apache2/bin/apachectl start
&停止Apache:/usr/local/apache2/bin/apachectl stop&重启Apache:/usr/local/apache2/bin/apachectl restart
网站放在/usr/local/apache2/htdocs目录下
在IE中通过http://localhost:80,如果看到页面中显示&It works!&字样,则代表Apache验证通过。如果网站的index后缀是PHP格式的,则要修改httpd.conf配置文件(/usr/local/apache2/conf),在DirectoryIndex增加 index.php。
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
&IfModule dir_module&
DirectoryIndex index.html index.php
&/IfModule&
阅读(...) 评论()
多年性能测试、测试管理经验,专注银行、支付、电商行业,倾向于性能、安全、 监控、调优、模型、管理等方向的研究。
使用技术手段解决问题,坚信注重每一个细节,把熟悉的做到一种极致,一定会有创新出现。扫描二维码: 已优化适合手机访问
&&★ 相关文章

我要回帖

更多关于 linux如何启动apache 的文章

 

随机推荐