Articles of cgi

CentOS 7 acl不适用于Apache

我想从一个CGI脚本访问用户的目录。 我成功地在目录上设置了acl,但是当试图访问该目录时脚本仍然获得“权限被拒绝”。 我su'd阿帕奇,并有相同的问题(所以它不是一个networking服务器/脚本问题)。 我错过了什么? #getfacl / home / pmedrano / Maildir / cur / getfacl:从绝对path名中删除前导'/' #file:home / pmedrano / Maildir / cur / #所有者:pmedrano #组:pmedrano 用户:: RWX 用户:阿帕奇:RX 组:: – – 组:阿帕奇:RX 面具:: RX 其他:: – – 默认:用户:: RWX 默认:用户:阿帕奇:RX 默认:组:: — 默认:组:阿帕奇:RX 默认:面膜:: RX 默认:其他:: — #su -s / bin / bash apache bash-4.2 […]

我的网站被黑客入侵(Bluehost)?

我运行一个简单的BlueHost网站,我需要使用自定义的Python脚本,所以我在我的网站的目录中创build了一个cgi-bin文件夹,并在那里添加了我的cgi python文件。 每次我试图使用AJAX请求来使用CGI脚本,但是,服务器不断返回500错误。 这是主要的错误日志显示: [Sun Nov 30 15:49:15 2014] [error] [client 91.121.209.34] ModSecurity: Access denied with code 406 (phase 1). Pattern match "Mozilla\\\\/5\\\\.0 \\\\(Windows; U; Windows NT 5\\\\.1; ru; rv:1\\\\.9\\\\.0\\\\.2\\\\) Gecko\\\\/2008091620 Firefox\\\\/3\\\\.0\\\\.2" at REQUEST_HEADERS:User-Agent. [file "/etc/httpd/modsecurity.d/eig_rules.conf"] [line "58"] [id "900228"] [msg "Wordpress Brute Force :: Firefox 8"] [hostname "anewroundtable.com"] [uri "/wp-login.php/"] [unique_id "VHue6zJX@FcAADAOSWgAAACA"] [Sun Nov […]

在加载AuthType之前Apache可能启动一个脚本?

我想在加载apache基本authentication之前运行一个脚本。 例如:我在我的浏览器中input一个url,获得基本authentication(用户名密码)字段,此时脚本应该已经被执行了。 是这样的可能吗? 先谢谢了

mod_rewrite不能在web根目录上工作

在下面的Apache / mod_rewriteconfiguration文件中,我得到了root / var / www /上的任何CGI脚本的403禁止错误。我没有得到任何静态文件的错误。 根目录的脚本,即/var/www/random/script.cgi正常工作,没有错误。 在RewritedEngineclosures的情况下,CGI脚本即使在root / var / www / <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory /> Options FollowSymLinks Options SymLinksIfOwnerMatch AllowOverride All <IfModule mod_rewrite.c> RewriteEngine on </IfModule> </Directory> <Directory /var/www/> Options +ExecCGI Options SymLinksIfOwnerMatch Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all AddHandler cgi-script .cgi […]

用cgi shell脚本重启apache实例

我试图从我的浏览器在服务器上重新启动我的apache实例。 为此,我正在使用cgi的shell脚本。 以下是我的代码片段。 echo '<FORM METHOD="GET" ACTION="">' echo '<select name=Website>' for file in $(find /etc/apache/* -maxdepth 0 -type d | cut -c1-23 –complement) do echo "<option value=$file>$file</option> " done echo '</select>' echo "<br><br>" echo '<INPUT TYPE="submit" VALUE="Stop">' echo '</FORM>' website_name=`echo "$QUERY_STRING" | sed "s|Website=||"` cd /etc/apache if [ -d "$site" ] then sudo /etc/init.d/apache stop […]

CGI警告中的随机换行写入到Apache错误日志中

由于将服务器从Debian 7.8升级到8.2(64位),Apache升级(到2.4.10)引入了一个非常奇怪的错误:error_log中的随机换行符。 例: [Mon Nov 16 13:29:54.388526 2015] [cgi:error] [pid 9122] [client xx.xx.xx.xx:1865] AH01215: (Fred, Test) Warning: foo.cgi/Foo.pm::foo():115 "Argument "test" isn't numeric i, referer: http://… [Mon Nov 16 13:29:54.390770 2015] [cgi:error] [pid 9122] [client xx.xx.xx.xx:1865] AH01215: n numeric eq (==)" [GET http://…], referer: http://… 在这里,CGI警告已经被分解为“in”这个词。 添加换行符的行内的位置是随机的,并将效果应用于随机行。 看到连续出现同一错误的几个实例(例如循环内发生的错误)是非常正常的,只有其中一行受随机行中断影响。 通过“说STDERR sprintf(…)”的方式将文本写入错误日志,这完全没有发生在以前版本的Debian / Apache / Perl(目前是Apache 2.4和Perl 5.20.2)中。 […]

同时在apache中启用CGI中的gzip和$ STR_REPLACE

我在我的CGI脚本中有一个用于replace文本的代码(例如用'blue'代替'red') $STR_SEARCH='red' $STR_REPLACE='blue' 我在.htaccess使用下面的代码来启用replace函数:(RequestHeader unset Accept-Encoding) 这工作很好。 但是当我想使用gzip进行压缩时,gzip不起作用。 如果我禁用replace,gzip工作正常。 请帮我理解如何同时启用replace和gzip?

干净的方式在Mac上运行Perl的CGI脚本?

我试图运行服务器来在我的Mac上提供Perl文件,但是我不想使用Apache及其CGI。 有没有一种干净的方式,一个Python的SimpleHTTPServer,运行Perl而不用Apache分离?

运行一个Python脚本,用cgi和apache2 2.4版本将文件保存到服务器

我有一个位于/ var / www / html / Python文件夹中的python脚本(python.py)。 该脚本将一些图像保存到另一个目录(/ var / www / html / Data) 我对python.py脚本具有-x文件权限,并且在保存输出的文件上对所有文件具有-rw权限。 我正在运行apache2版本2.4 这就是我的apache2.conf文件的样子: Mutex file:${APACHE_LOCK_DIR} default PidFile ${APACHE_PID_FILE} Timeout 300 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 5 User ${APACHE_RUN_USER} Group ${APACHE_RUN_GROUP} HostnameLookups Off LogLevel warn IncludeOptional mods-enabled/*.load IncludeOptional mods-enabled/*.conf Include ports.conf <Directory /> Options FollowSymLinks AllowOverride None Require all denied […]

获取python cgi脚本的权限被拒绝

我想运行一个python脚本,它会产生graphics并将它们保存到一个文件夹中。 我在Ubuntu上运行apache 2.4,我的脚本在命令行上工作正常。 CGI模块已启用。 我已经为脚本运行了“全部”的权限,并将下面的代码添加到了我的apache2.config文件中: <Directory "/var/www/html/Python"> Options +ExecCGI AddHandler cgi-script .cgi .pl .py Require all granted </Directory> 根据我在网上阅读的东西,这应该工作,但错误日志说,权限被拒绝。 我错过了什么?