Linux under Apache deployment
1. Build Users
[root]# Groupadd Apache
[root]# useradd apache-g Apache
[root]# passwd Apache
[root]# Su-apache
2. Download openssl-1.0.2g.tar.gz to User directory ~ (/home/apache/)
[Apache] #tar-ZXVF openssl-1.0.2g.tar.gz
[Apache] #cd openssl-1.0.2g
[Apache] #mkdir/opt/openssl
[Apache]#./config--prefix=/opt/openssl
[Apache] #make && make install
3. Download httpd-2.2.22.tar.gz to User directory ~ (/home/apache/)
[Apache] #tar-ZXVF httpd-2.2.22.tar.gz
[Apache] #cd: /httpd-2.2.22
[Apache] #export LDFLAGS=-LDL//execute the following command, it is best to add this sentence, or may error: Configure:error: ... Error, SSL/TLS libraries were missing or unusable
[Apache]#./configure--prefix=/opt/httpd--enable-so--enable-info--enable-headers--enable-mods-shared=all-- Enable-ssl=static--with-ssl=/opt/openssl
Specify module:./configure--prefix=/opt/httpd--enable-so--enable-info--enable-headers--enable-mods-shared= "proxy proxy_ HTTP Proxy_connect "--enable-ssl=static--with-ssl=/opt/openssl--enable-rewrite--enable-speling--enable-forward
[Apache] #make//Compile Apache
[Apache] #make Install//installation Apache
or compile and install Apache
[Apache] #make && make install
Note that non-root 1024 ports are not available and you need to modify the default 80 port to another available port
Vi/opt/httpd/conf/httpd.conf
4. View the Agent module and install:
./apachectl-m|grep Proxy
If you do not have any modules, install the steps: (Note: PROXY_UTIL.C is the base module and must be installed first.) If there is an error, add it after each command)
Cd/home/apache/httpd-2.2.22/modules/proxy
/opt/httpd/bin/apxs-c-i-a mod_proxy.c proxy_util.c
/opt/httpd/bin/apxs-c-i-a mod_proxy_http.c
/opt/httpd/bin/apxs-c-i-a mod_proxy_ftp.c
/opt/httpd/bin/apxs-c-i-a mod_proxy_connect.c
/opt/httpd/bin/apxs-c-i-a mod_proxy_balancer.c
/opt/httpd/bin/apxs-c-i-a MOD_PROXY_SCGI.C
/opt/httpd/bin/apxs-c-i-a mod_proxy_ajp.c ajp*.c
httpd.conf proxy configuration, for example:
#开启代理服务, the client can specify the current IP and port as the proxy configuration
Proxyrequests on
#代理指向如果是https协议, this property must be added, otherwise the forwarding error
Sslproxyengine on
Proxypass/https/https://url/
Proxypassreverse/https/https://url/
Proxypass/http/http://url/
Proxypassreverse/http/http://url/
Listen 8081
<ifmodule mod_proxy.c>
<virtualhost *:8081>
Proxyrequests on
#配置允许访问的目的地址以及可使用代理的来源地址
<proxy *>
Order Deny,allow
Allow from all
#allow from IP1 IP2 ...
</Proxy>
</VirtualHost>
</IfModule>
SSL Plus virtual machine configuration
Listen 9443
Namevirtualhost *:9443
<virtualhost *:9443>
#ServerName domain:9443
DocumentRoot Htdocs
DirectoryIndex index.htm
#Sslengine on
#sslverifyclient require
Sslverifydepth 10
#sslcertificatefile CONF/SERVER.CRT
#sslcertificatekeyfile Conf/server.key
#sslcacertificatefile conf/cfca_test_cs_ca.cer
#sslcertificatechainfile conf/cfca_test_oca1.cer
Sslciphersuite all:! Adh:! Export56:rc4+rsa:+high:+medium:+low:+sslv2:+exp:+enull
Ssloptions +stdenvvars
#proxyrequests on
#Sslproxyengine on
#proxypass/http/http://url/
#proxypassreverse/http/http://url/
</VirtualHost>
If you have root privileges, you can add Apache to the auto-start service:
[Root] #chkconfig--list httpd//See if the HTTPD service already exists
[Root] #chkconfig httpd off//shutdown system comes with httpd service if httpd service is present
[Root] #service httpd status//view your own httpd service status
[Root]#/opt/httpd/bin/apachectl-k start//linux launch Apache command
[Root] #netstat-an|grep:80//See if the linux80 port is turned on
[Root] #ps-aux|grep httpd//linux View Apache Process
[Root] #cd: /..
[Root] #cp/opt/httpd/bin/apachectl/etc/rc.d/init.d/apache//copy Apache boot script
[Root] #vi/etc/rc.d/init.d/apache//This is the edit Apache startup script
At the beginning of the #! /bin/sh under (unknown effect)
#chkconfig: 2345 85 15
[Root] #chkconfig--add Apache//Add Apache Service
[Root] #chkconfig--list Apache//list Apache Services
[Root] #service Apache stop//Stop Apache Service
[Root] #netstat-an|grep:80//See if the 80 port of Linux is off
[Root] #ps-aux|grep httpd//To see if there is a httpd service, if the previous boot from the HTTPD service will cause the newly added Apache service to fail to start
[Root] #service Apache start//Start Apache Service
Open the server IP address to see if there is an IT works!, if it appears, Apache has been installed successfully
Root user, Apache startup, shutdown, restart
Start command: Service httpd start
Shutdown command: Service httpd stop
Restart command: Service httpd restart
Status query: Service httpd status
Under non-root user, Apache startup, shutdown, restart
Start command:/opt/httpd/bin/apachectl start
Close command:/opt/httpd/bin/apachectl stop
Restart command:/opt/httpd/bin/apachectl restart
Status query:/opt/httpd/bin/apachectl status
This article is from "Worry-free" blog, please be sure to keep this source http://dezewuyou.blog.51cto.com/2628602/1867158
Linux under Apache deployment