symfony框架下服务器(linux-Ubuntu)部署的一些常见问题[汇总中]

一、修改配置文件

1.Ubuntu apache2.conf 是主配置文件,httpd.conf 用户配置文件

2.虚拟目录在 httpd.conf 中

3.根设置(默认主目录)在 /etc/apache2/sites-available/default

  在Windows下,Apache的配置文件通常只有一个,就是httpd.conf。但我在Ubuntu Linux上用apt-get install apache2命令安装了Apache2后,竟然发现它的httpd.conf(位于/etc/apache2目录)是空的!进而发现Ubuntu的 Apache软件包的配置文件并不像Windows的那样简单,它把各个设置项分在了不同的配置文件中,看起来复杂,但仔细想想设计得确实很合理。

  严格地说,Ubuntu的Apache(或者应该说Linux下的Apache?我不清楚其他发行版的apache软件包)的配置文件是/etc /apache2/apache2.conf,Apache在启动时会自动读取这个文件的配置信息。而其他的一些配置文件,如httpd.conf等,则 是通过Include指令包含进来。在apache2.conf中可以找到这些Include行:

# Include module configuration:  

Include /etc/apache2/mods-enabled/*.load  

Include /etc/apache2/mods-enabled/*.conf
 

# Include all the user configurations:  

Include /etc/apache2/httpd.conf
 

# Include ports listing  

Include /etc/apache2/ports.conf
 

# Include generic snippets of statements  

Include /etc/apache2/conf.d/
 

# Include the virtual host configurations:  

Include /etc/apache2/sites-enabled/ 

  结合注释,可以很清楚地看出每个配置文件的大体作用。当然,你完全可以把所有的设置放在Ubuntu apache2.conf或者httpd.conf或者任何一个配置文件中。Ubuntu apache2的这种划分只是一种比较好的习惯。

  参考http://os.51cto.com/art/201002/183321.htm

 

二、重启Apache

  在Ubuntu中“应用程序”-“附件”-“终端”打开命令窗口,输入如下内容即可:

sudo /etc/init.d/apache2 restart

或者  

cd /etc/init.d  

sudo apache2 -k restart  

stop 停止;start 启动

 

// Apache  
//Task: Start Apache 2 Server /启动apache服务  
# /etc/init.d/apache2 start 
//or  
$ sudo /etc/init.d/apache2 start 
//Task: Restart Apache 2 Server /重启apache服务  
# /etc/init.d/apache2 restart 
//or  
$ sudo /etc/init.d/apache2 restart 
//Task: Stop Apache 2 Server /停止apache服务  
# /etc/init.d/apache2 stop 
//or  
$ sudo /etc/init.d/apache2 stop  
// Mysql  
/etc/init.d/mysql start 
/etc/init.d/mysql stop 
/etc/init.d/mysql restart


日志文件在 /var/log/apache2/

// httpd是Apache超文本传输协议(HTTP)服务器的主程序。被设计为一个独立运行的后台进程,它会建立一个处理请求的子进程或线程的池。  
// 通常,httpd不应该被直接调用,而应该在类Unix系统中由 apachectl 调用  
// man apache2 中介绍  
// apache2 is the Apache HyperText Transfer Protocol (HTTP) server program.  
// It is designed to be run as a standalone daemon process. When  used  like  
// this it will create a pool of child processes or threads to handle requests.  
// In general, apache2 should not be invoked directly,  
// but rather should be invoked via /etc/init.d/apache2 or apache2ctl.  
// The default Debian config-uration requires environment variables  
// that are defined in /etc/apache2/envvars and are not available if apache2 is  started  directly.  
// However,apache2ctl can be used to pass arbitrary arguments to apache2.  
//  
// apache2ctl = apache2 ConTroL  
//  
apache2ctl -restart 
apache2ctl -stop 
apache2ctl -t 
// 详细见 man apache2

参考:http://blog.csdn.net/phpandjava/article/details/4636610

 


posted @ 2011-11-28 15:31  great wang  阅读(285)  评论(0编辑  收藏  举报