Skip to content

Instantly share code, notes, and snippets.

@yongkangchen
Last active March 20, 2023 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yongkangchen/06112fcaac32fd494c711424d5fd4654 to your computer and use it in GitHub Desktop.
Save yongkangchen/06112fcaac32fd494c711424d5fd4654 to your computer and use it in GitHub Desktop.
apache2+cgi
apache2 conf:
<VirtualHost *:80>
DocumentRoot /var/www/html/cgidir
<Directory "/var/www/html/cgidir">
AllowOverride All
</Directory>
</VirtualHost>
.htaccess:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^ /index.html [L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
AddHandler cgi-script .py
Options +ExecCGI
RewriteRule ^(.*)$ /main.py?params=$1 [L,QSA]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment