Skip to content

Instantly share code, notes, and snippets.

@logicmd
Created November 6, 2012 09:50
Show Gist options
  • Save logicmd/4023763 to your computer and use it in GitHub Desktop.
Save logicmd/4023763 to your computer and use it in GitHub Desktop.
How to configure Apache

How to configure Apache

Alias Configure

In /etc/apache2/mods-enabled/alias

Alias /vod/ "/home/tangkai/www/vod/"

<Directory "/home/tangkai/www/vod/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Deny,Allow
    Allow from all
    #Deny from all
    #Allow from 127.0.0.1
</Directory>

CGI Configure

In /etc/apache2/sites-enabled/000-default

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    AddHandler cgi-script .cgi .pl
    Order allow,deny
    Allow from all
</Directory>

ScriptAlias /www/cgi-bin/ /home/tangkai/www/cgi-bin/
<Directory "/home/tangkai/www/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

Reverse Proxy Configure

In C:\wamp\bin\apache\Apache2.2.21\conf\extra\httpd-vhosts.conf

<VirtualHost *:80>
    ServerName  s.logicmd.net
    ServerAdmin [email protected]
    DocumentRoot "c:/Apache2/docs/dummy-host.example.com"
    ErrorLog "logs/s.logicmd.net.log"
    CustomLog "logs/s.logicmd.net.log" common
    ProxyPass / http://172.31.200.49/
    ProxyPassReverse / http://172.31.200.49/
    <proxy  http://172.31.200.49/>
        AllowOverride None
        Order Deny,Allow
        Allow from all
    </proxy>
</VirtualHost>

Permissions Configure

sudo visudo

#User_Alias  APACHE = www-data
#Cmnd_Alias  FIREWALL = /sbin/iptables, /sbin/ifconfig, /sbin/route

#APACHE  ALL = (ALL) NOPASSWD: FIREWALL
www-data ALL = (ALL) NOPASSWD: /sbin/tc
#www-data ALL = NOPASSWD: ALL

Inspect Apache log in flow

tail -f /var/log/apache/error.log

[1]http://ubuntuforums.org/showthread.php?t=639803 [2]http://stackoverflow.com/questions/3166123/how-to-call-shell-script-from-php-that-requires-sudo [3]http://stackoverflow.com/questions/4272246/how-do-i-get-access-control-allow-origin-to-work [4]http://enable-cors.org/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment