LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-26-2012, 12:18 AM   #1
itdungpt
LQ Newbie
 
Registered: Feb 2012
Posts: 20

Rep: Reputation: Disabled
disable .cgi on server


hi all

how to disable .cgi .pl on centos server apache ?
help me
 
Old 02-26-2012, 01:45 AM   #2
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Hi,

well, It can be done in many ways (htaccess, directory, global file type...)

so a quick "disable" for all could be:

# /etc/httpd/conf/httpd.conf
Code:
# COMMENT the next lines like so:

# LoadModule cgi_module modules/mod_cgi.so

# AddHandler cgi-script .cgi .pl
now # commented these lines and restarting Apache (# service httpd restart) will not execute .cgi scripts

you could also make it show like a text file with:
Code:
#add this line where other similar lines exist -> AddType text/html .shtml
AddType text/html .cgi .pl
then you have an option to disable it "per directory" with (Apache options):
Code:
<Directory "/var/www/sitedomain">
 AllowOverride None
  Options -ExecCGI
  Order allow,deny
  Allow from all
</Directory>

Last edited by lithos; 02-26-2012 at 01:46 AM.
 
Old 02-26-2012, 04:28 AM   #3
itdungpt
LQ Newbie
 
Registered: Feb 2012
Posts: 20

Original Poster
Rep: Reputation: Disabled
- cgi build from easyapache so have not # LoadModule cgi_module modules/mod_cgi.so
- I just create a file. htaccess is possible to disable the things you just mentioned.

AddHandler application/x-httpd-php4 .php .php4 .php3
Options +FollowSymLinks +Indexes
DirectoryIndex default.html
AddType text/html php
Options +ExecCGI
AddHandler cgi-script cgi pl xt love mrp


I think this is an impractical method.
 
Old 02-26-2012, 06:12 AM   #4
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by itdungpt View Post
- cgi build from easyapache so have not # LoadModule cgi_module modules/mod_cgi.so
- I just create a file. htaccess is possible to disable the things you just mentioned.

AddHandler application/x-httpd-php4 .php .php4 .php3
Options +FollowSymLinks +Indexes
DirectoryIndex default.html
AddType text/html php
Options +ExecCGI
AddHandler cgi-script cgi pl xt love mrp


I think this is an impractical method.
Then use these setting in httpd.conf file to make it used in the Apache server on the whole system.

Find a 'terminal window' (how-to) in cPanel and manually edit it as root user (as far as I see easyapache is just a script module for cPanel to do the settings through WHM)

Last edited by lithos; 02-26-2012 at 06:19 AM.
 
Old 02-26-2012, 07:48 AM   #5
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,627

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
Or

If there is no strict requirement for Apache, you could run a different web server that allows easier control over these functions.
(I liked Xitami, but it is no longer supported. Lighttpd looks good. )

You might check out pages like this one: http://slodive.com/web-development/l...s-web-servers/
 
Old 02-26-2012, 08:48 AM   #6
itdungpt
LQ Newbie
 
Registered: Feb 2012
Posts: 20

Original Poster
Rep: Reputation: Disabled
AllowOverride All|None|directive-type

can you tell me directive-type ?

i want disable AddHandler on .htaccess
 
Old 02-26-2012, 09:45 AM   #7
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Hi,

I'm sorry I can't tell you the exact config, but[quote]If AllowOverride is set to AllowOverride All, this tells Apache that it's okay to allow .htaccess files to over-ride previous directives. You must reload Apache before this change will have an effect[quote]

htaccess directives
Quote:
The use of .htaccess files can be disabled completely by setting the AllowOverride directive to none
See below the Server Side Includes example in above linked manual
--> CGI example
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How disable x-server (graphics) on my linux debian server? halvorls Linux - Server 2 06-26-2008 01:20 PM
server load script cgi newuser455 Programming 1 06-22-2005 07:57 PM
CGI Internal server error newuser455 Linux - General 2 06-10-2004 09:39 PM
Apache server and cgi-bin? WorldBuilder Linux - Networking 15 09-18-2003 12:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration