Instant Apache Proxy Setup
Needed to enabled instant proxy in your server? This is simply tutorial on how to enabled proxy. You at least must have root SSH access or ability to edit httpd.conf (apache) file.
Requirement
- SSH console like putty or SFTP client software like WinSCP for Windows ( i recommended you to using portable version)
- SSH root access or an server / VPS control panel (so you can restart http)
- An OpenVz VPS (in this tutorial i have tried on OpenVz based).
1. Open And Edit httpd.conf
Browse / locate to your httpd.conf file and open to edit in directory: /etc/httpd/conf
Find / locate line to proxy configuration, we need to uncomment all proxy setting and protect it from public access (read step 2)
2. Protecting Your Proxy
Next step we must protecting our proxy to prevent accessed from public. So we need to creating .htapasswd file and place it to httpd directory, then change access entry in httpd.conf.
Changing default port from 80 to another else also will prevent to public for guessing your proxy port. Adding this line on etc/sysconfig/iptables file
iptables -A INPUT -p tcp --dport 889 -j ACCEPT
Will open port 889
Now proxy config line in httpd.conf will be like this after protect with .htapasswd auth and change default port (to port 889):
<IfModule mod_proxy.c>
ProxyRequests On
Listen 889
#
<Proxy *>
Order deny,allow
Allow from All
AuthType Basic
AuthName "Private"
AuthUserFile /etc/httpd/conf/.htpasswd
Require user yourusername
</Proxy>
#<Proxy *>
# Order deny,allow
# Deny from all
# Allow from .example.com
#</Proxy>
#
# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block
#
ProxyVia On
#
# To enable a cache of proxied content, uncomment the following lines.
# See http://httpd.apache.org/docs/2.2/mod/mod_cache.html for more details.
#
#<IfModule mod_disk_cache.c>
# CacheEnable disk /
# CacheRoot "/var/cache/mod_proxy"
#</IfModule>
#
</IfModule>
# End of proxy directives.
Now you can saved and close httpd.conf file.
notes: you can also uncomment mod_disk_cache to improve proxy speed, but if you have active site on the server its not recommended to uncomment that.
3. Restart httpd Service
We need to restart httpd service to run this command on putty / ssh:
service httpd restart
now your private apache proxy ready to use.
4. Usage
Example proxy setup in Mozila Firefox,
- choose Tools -> Options -> Advanced
- In advanced tab choose Network then click settings
- Choose to Manual Proxy Configuration
- Enter your IP address and port number there.
- Proxy now ready in your browser, you will prompt to fill username and password that you created before.
Related posts:
Tweet This





