apache2.2 apache2.4

ubuntu12.04默认安装apache2.2  没找到查询版本号的方法。解决方法 sudo apt-get install apache2

提示安装以下软件: apache2-mpm-worker apache2.2-bin apache2.2-common libaprutil1-dbd-sqlite3 libaprutil1-ldap

之后,就可以正常使用apache2 -v命令了。一共三个:apache2     apache2ctl  apachectl

ubuntu14.04默认安装apache2.4 使用 apache2 -v即可查询版本号。

httpd-2.2.x(prefork)
httpd-2.4.x(event) 编译时可以使用--with-mpm=prefork手动指定其使用prefork

PHP官方推荐httpd使用prefork(php能更稳定地运行),而不是线程化的worker和event,httpd-2.4.x默认使用线程化的event作为mpm.

Linux上很多PECL库都是非线程安全的,libphp5.so在线程化的httpd(event/worker)中运行可能会出现一些问题,为了保持兼容性和稳定性,PHP一般还是使用httpd-2.2.x(prefork)这个分支.

原因很简单,linux上升级软件很困难,没人敢冒险升级   如果不出大问题,服务器的软件很少有大的升级
2.4 apache2.conf 文件逻辑更清晰,直接修改directory.

2.2 在/etc/apache2/mods-available中建立python.load      python.conf

apache支持静态页,tomcat支持动态的,比如servlet等,
一般使用apache+tomcat的话,apache只是作为一个转发,对jsp的处理是由tomcat来处理的。
apche可以支持phpcgiperl,但是要使用java的话,你需要tomcatapache后台支撑,将java请求由apache转发给tomcat处理。
apache是web服务器,tomcat是应用(java)服务器,它只是一个servlet(jsp也翻译成servlet)容器,可以认为是apache的扩展,但是可以独立于apache运行。
这两个有以下几点可以比较的:
1、两者都是apache组织开发的
2、两者都有HTTP服务的功能
3、两者都是免费的
不同点:
Apache是专门用了提供HTTP服务的,以及相关配置的(例如虚拟主机、URL转发等等)
TomcatApache组织在符合J2EE的JSP、Servlet标准下开发的一个JSP服务器



On Ubuntu, I am trying to get the httpd.conf file for apache2. My server does not show one.

Would apache2.conf be the same as httpd.conf?

apache2.conf: the main Apache2 configuration file. Contains settings that are global to Apache2.

httpd.conf: historically the main Apache2 configuration file, named after the httpd daemon. The file can be used for user specific configuration options that globally effect Apache2.

So to echo @slhck - I would source the httpd.conf from the apache2.conf.

httpd.conf is empty (or nonexistent) in some distributions. If anapache2.conf is present you should probably not edit this, but include your ownhttpd.conf from the apache2.conf. This is because apache2.conf may be overwritten by package updates.

Your apache2.conf therefore should include this line. If it doesn't already, you can add it yourself:

Include httpd.conf

/etc/apache2/conf.d is also a good place to put configuration files.


Apache2.2和Apache2.4中httpd.conf配置文件的异同


编辑: upupw 发布时间: 2013-08-09 11:32:01 来源: UPUPW绿色服务器平台 热度: 8780

Windows环境从Apache2.2改成Apache2.4后httpd.conf中的设置异同。

1、权限设定方式变更

2.2使用Order Deny / Allow的方式,2.4改用Require

apache2.2:

Order deny,allow
Deny from all
apache2.4:
Require all denied
此处比较常用的有如下几种:

Require all denied

Require all granted

Require host xxx.com

Require ip 192.168.1 192.168.2

Require local

注意:若有设定在htaccess文件中的也要修改

2、设定日志纪录方式变更

RewriteLogLevel 指令改为 logLevel

LOGLEVEL设置第一个值是针对整个Apache的预设等级,后方可以对指定的模块修改此模块的日志记录等级

比如:
LogLevel warn rewrite: warn

3、Namevirtualhost 被移除

4、需载入更多的模块

开启Gzip在apache2.2中需载入mod_deflate,apache2.4中需载入mod_filter和mod_deflate

开启SSL在apache2.2中需载入mod_ssl,apache2.4中需载入mod_socache_shmcb和mod_ssl

5、在windows环境建议的设置

EnableSendfile Off
EnableMMAP Off

当Log日志出现AcceptEx failed等错误时建议设置

AcceptFilter http none
AcceptFilter https none

说明:Win32DisableAcceptEx在apache2.4中被AcceptFilter None取代

6、Listen设定的调整

以443为例,不可以只设定Listen 443

会出现以下错误:

(OS 10048)一次只能用一个通讯端地址(通讯协定/网路位址/连接) : AH00072: make_sock: could not bind to address [::]:443

(OS 10048)一次只能用一个通讯端地址(通讯协定/网路位址/连接) : AH00072: make_sock: could not bind to address 0.0.0.0:443

AH00451: no listening sockets available, shutting down

AH00015: Unable to open logs

因此需指定监听的IP,可设定多个

例如:

Listen 192.168.2.1:443
Listen 127.0.0.1:443

在ubuntu下启动apache和mysql的命令

  1. // Apache  
  2. //Task: Start Apache 2 Server /启动apache服务  
  3. # /etc/init.d/apache2 start  
  4. //or  
  5. $ sudo /etc/init.d/apache2 start  
  6. //Task: Restart Apache 2 Server /重启apache服务  
  7. # /etc/init.d/apache2 restart  
  8. //or  
  9. $ sudo /etc/init.d/apache2 restart  
  10. //Task: Stop Apache 2 Server /停止apache服务  
  11. # /etc/init.d/apache2 stop  
  12. //or  
  13. $ sudo /etc/init.d/apache2 stop   
  14. // Mysql  
  15. /etc/init.d/mysql start  
  16. /etc/init.d/mysql stop  
  17. /etc/init.d/mysql restart 

ppeix:apache2$ apachectl start
/usr/sbin/apachectl: 87: ulimit: error setting limit (Operation not permitted)
Syntax error on line 15 of /etc/apache2/sites-enabled/000-default:
Invalid command 'PythonHandler', perhaps misspelled or defined by a module not included in the server configuration
Action 'start' failed.
The Apache error log may have more information.
解决办法:安装ppeix:apache2$ sudo apt-get install libapache2-mod-python
ppeix:apache2$ apachectl start
/usr/sbin/apachectl: 87: ulimit: error setting limit (Operation not permitted)
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information.




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值