ubuntu上安装配置apache

卸载

 

# apt-get --purge remove apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap

 

 

安装

 

# apt-get install apache2

 

 

启动服务

 

sudo apachectl start
service apache2 start

 

 

停止服务

 

sudo apachectl stop
service apache2 stop

 

重启服务

service apache2 restart

 

 

查找

 

locate apache2

 

 

正向代理及反向代理(ProxyPass\ProxyPassReverse)配置

(1)

开启proxy、proxy_http等模块

 

a2enmod proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http

 (2)

 

修改配置

 

sudo vim /etc/apache2/mods-enabled/proxy.conf

 设置如下:

 

<IfModule mod_proxy.c>
    #turning ProxyRequests on and allowing proxying from all may allow
    #spammers to use your proxy to send email.
ProxyRequests Off
ProxyRequests Off
<Proxy *>
        Options Indexes FollowSymLinks
        AllowOverride None
        #AddDefaultCharset off
        #Order deny,allow
        #Deny from all
        #Allow from .example.com
</Proxy>

 

(3)

修改配置

vim /etc/apache2/httpd.conf

 

<VirtualHost *:80>
        ProxyPass / http://localhost:8069/
        ProxyPassReverse / http://localhost:8069/
</VirtualHost>

 

 

 

你可能感兴趣的:(apache)