Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example cgi script in LAMP/LAPP appliances is not working #722

Closed
JedMeister opened this issue Nov 1, 2016 · 5 comments

Comments

Projects
None yet
3 participants
@JedMeister
Copy link
Member

commented Nov 1, 2016

The example cgi script included in the LAMP and LAPP appliances is not currently working. It appears that there was a significant Apache 2.4 config change that messed up our default config.

Thanks to Alex for reporting on the forums

@JedMeister JedMeister added this to the 14.2 milestone Nov 1, 2016

@JedMeister

This comment has been minimized.

Copy link
Member Author

commented Nov 1, 2016

@JedMeister

This comment has been minimized.

Copy link
Member Author

commented Nov 1, 2016

Here's the specifics on working around it:

OLD=usr/lib/cgi-bin
NEW=var/www/cgi-bin
FILE=/etc/apache2/conf-available/serve-cgi-bin.conf
sed -i "s|$OLD|$NEW|g" $FILE

Plus we need to enable the cgi module:

a2enmod cgi

And finally restart Apache:

service apache 2 restart
@whampt

This comment has been minimized.

Copy link

commented Nov 18, 2016

Not working

@whampt

This comment has been minimized.

Copy link

commented Nov 18, 2016

Done all. Can work with as my mac shows the page correctly, but not my linux box. This is only a test server, so its kind of ok. Would really like to know what I need to do here to get apache to serve perl as cgi. Am very new to apache, thanks

server-cgi-bin.conf

<IfModule mod_alias.c>
        <IfModule mod_cgi.c>
                Define ENABLE_USR_LIB_CGI_BIN
        </IfModule>

        <IfModule mod_cgid.c>
                Define ENABLE_USR_LIB_CGI_BIN
        </IfModule>

        <IfDefine ENABLE_USR_LIB_CGI_BIN>
                ScriptAlias /cgi-bin/ /var/www/cgi-bin/
                <Directory "/var/www/cgi-bin">
                        AllowOverride None
                        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                        Require all granted
                </Directory>
        </IfDefine>
</IfModule>

000-default.conf

ServerName localhost

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/
</VirtualHost>

<VirtualHost *:443>
        SSLEngine on
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/

ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory "/var/www/cgi-bin">
        AllowOverride None
        Options +ExecCGI -Multiviews +SymLinksIfOwnerMatch 
        Require all granted    

        AddHandler cgi-script cgi
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


@JedMeister

This comment has been minimized.

Copy link
Member Author

commented Nov 20, 2016

When I posted my fix instructions above, I had tested this on TKL LAMP v14.1 and confirmed that it worked. So I'm not sure why it's not working for you?! Unfortunately I don't have a running server handy, but I'll try to double check

I did noticed that I had set the paths of OLD and NEW as relative (to root - /) rather than absolute. I updated my previous post to use absolute paths, then realised that I had done that on purpose... Doh! So I changed it back...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.