Forum > Raspbian
BryanFRitt 看全部
2016-7-26 04:23:22
I set up Apache as webserver that hosts a webpage, and that works. But when I try to run my sh cgi script I get a "Internal Server Error", and the log shows as "...Premature end of script headers..." followed by a "...Zlib: Compressed..." for every browser attempt to load the file. I've even tried with close to the simplest script I could make; same results. I also ran `service apache2 restart` after making changes.
When run from the terminal, my sh script works like it's supposed to.
How can I get this working? Do I need to install something, change some setting, or do something else?
/bin/echo 'Content-type: text/html';
/bin/echo '';
/bin/echo '<head>';
/bin/echo '<title>LOCALCUPSLINK</title>';
/bin/echo '</head>';
/bin/echo '<body>';
/bin/echo '<p><a href="localhost:631">local cups webpage</a></p>';
/bin/echo '</body>';
/bin/echo '</html>';

# latest version of playing around with /etc/apache2/sites-available/default
<VirtualHost *:80>
        ServerAdmin soon,

        DocumentRoot /var/www/html
        <Directory />
                Options FollowSymLinks
                AllowOverride None

        <Directory /var/www/html>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                #RedirectMatch ^/$ /apache2-default/

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

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel debug

        CustomLog /var/log/apache2/access.log combined
        ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from ::1/128
BryanFRitt 看全部
2016-7-31 12:42:04
I've gotten cgi to work on my laptop, but not the Pi. Has anyone gotten cgi working Orange Pi using Raspbian? (or other OS)?
BryanFRitt 看全部
2016-8-6 08:31:18
Hate to start over, but curious, Is there an OS I can put on this headless OPP that can run cgi made with bash/sh?
rapduk 看全部
2022-1-21 16:44:53
Schools and universities generally block the sites that children use for entertainment. Like music sites, movies and games. They keep blocking sites as they discover them. Get gaming sites unblocked list here.

OrangePi En

Powered by Discuz! X3.4

homepage|Simple edition|Touch edition|PC