阿里云恢复快照mongodb和nodejs启动,linux下nginx和apache重启

14561次浏览

最近在我的阿里云服务器上面安装新的模块,不料安装出错!幸亏阿里云有快照还原,还原到昨天的。但是还原之后,mongodb和nodejs都要重新启动。

现在把重启的步骤再写一下!

我在很久之前的一篇文章,写了Centos6.5安装配置mongodb,添加了mongo的服务。启动只要如下命令就可以了

/etc/init.d/mongodb start

但是起不来,因为多了一个mongod.lock 文件,要把这个文件删除掉。

运行如下命令

[root@isdfsfsdfs home]# cd /usr/local/mongo/data/
mongod.lock  noderce/  
[root@isdfsfsdfs data]# rm mongod.lock 
rm: remove regular file `mongod.lock'? y
[root@isdfsfsdfs data]# /etc/init.d/mongodb start

然后控制台输出:

Starting MongoDB... forked process: 1052
[root@isdfsfsdfs data]# all output going to: /usr/local/mongo/mongodb.log

表示启动成功,然后再启动一下我的nodejs就可以了,关于nodejs,我之前写个nodejs博客的nginx配置CentOS安装NodeJS及Express开发框架,有兴趣的可以看一下。

[root@isdfsfsdfs data]# forever start /home/nodeblog/app.js

这样就可以再次启动我的博客了!

nginx的操作命令

nginx的启动命令是:

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

-c制定配置文件的路径,不加-nginx会自动加载默认路径的配置文件。

研究了一下nginx帮助后发现,有-s参数可对nginx服务进行管理:

# /usr/local/nginx/sbin/nginx -h
nginx version: nginx/0.7.63
Usage: nginx [-?hvVt] [-s signal] [-c filename] [-p prefix] [-g directives]
Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-s signal : send signal to a master process: stop, quit, reopen, reload 
-p prefix : set prefix path (default: /usr/local/nginx/)
-c filename : set configuration file (default: conf/nginx.conf)
-g directives : set global directives out of configuration file

于是我执行如下:

# /usr/local/nginx/sbin/nginx -s  reload 

nginx已经重启成功

linux 下 apache启动、停止、重启命令

本文假设你的apahce安装目录为/usr/local/apache,这些方法适合任何情况

apahce启动命令:

/usr/local/apache/bin/apachectl start apaceh

apache停止命令

/usr/local/apache/bin/apachectl stop  

apache重新启动命令:

/usr/local/apache/bin/apachectl restart

要在重启 Apache 服务器时不中断当前的连接,则应运行:

/usr/local/sbin/apachectl graceful

如果apache安装成为linux的服务的话,可以用以下命令操作:

service httpd start 启动
service httpd restart 重新启动
service httpd stop 停止服务

Linux系统为Ubuntu

一、Start Apache Server /启动apache服务

# /etc/init.d/apache start
or
$ sudo /etc/init.d/apache start

二、 Restart Apache Server /重启apache服务

# /etc/init.d/apache restart
or
$ sudo /etc/init.d/apache restart

三、Stop Apache Server /停止apache服务

# /etc/init.d/apache stop
or
$ sudo /etc/init.d/apache stop

致歉

最近我的博客在安装版块,服务器在配置,有时候可能造成博客短暂无法访问,请见谅!谢谢!

Tags: mongodbnodejs

相关文章: