≡ Menu


TCSH / CSH: set vs setenv Command Differences

I've recently started to use FreeBSD operating system with tcsh (c shell clone) shell. I noticed that both set and setenv command set shell user environment. What's the difference between the SET and SETENV commands?
[click to continue…]

Upgrading Red Hat Enterprise Linux From Version 6.2 to 6.3

Red Hat Enterprise Linux v6.3 has been released and available via RHN for immediate update. How do I upgrade my RHEL from 6.2 to the latest 6.3 version?
[click to continue…]

Q. I've installed Apache2 and mod_security21 under FreeBSD. Whenever I try to restart apach22 process I get following error:

Performing sanity check on apache22 configuration:
httpd: Syntax error on line 106 of /usr/local/etc/apache22/httpd.conf: Cannot load /usr/local/libexec/apache22/mod_security2.so into server: /usr/local/libexec/apache22/mod_security2.so: Undefined symbol "xmlFree"

How do I fix this problem?
[click to continue…]

Display Apache Server Status with mod_status

Q. How do I display Apache server status such as current server activity and performance under Red Hat Enterprise Linux / UNIX / BSD?
[click to continue…]

FreeBSD Configure Apache 2.2 PHP with FastCGI mod_fcgi Module

I'd like to switch from mod_php5 to mod_fastcgi. I'm using FreeBSD 7 release along with following software:

+ Apache 2.2
+ PHP as mod_php5
+ MySQL DB 5.1.23 server
How do I configure php as FastCGI server?
[click to continue…]

Apache Web Server Prevent Directory / Folder Listing

Q. If there is no index.html or index.php, Apache displays all other files in a Directory. How do I force Apache web server not to display my directory / folder list?

A.This controlled by a module called mod_autoindex or mod_dir.

You can completely remove (or replace) automatic index generation as per your requirements. The IndexIgnore directive adds to the list of files to hide when listing a directory. File is a shell-style wildcard expression or full filename. Multiple IndexIgnore directives add to the list, rather than the replacing the list of ignored files. By default, the list contains . (the current directory). Open your httpd.conf or .htaccess file and append following directive to block auto indexing for all pdf and mp3 files:
IndexIgnore *.pdf *.mp3
To enforce or deny complete folder listing, use *:
IndexIgnore *
Save and close the file. Restart httpd if httpd.conf was updated:
# service httpd restart

Further readings:

=> Apache mod_autoindex help pages.

Hide the Apache Web Server Version number with ServerSignature and ServerTokens directives

Q. How do I hide the Apache version number under CentOS Linux 5 server?

A. You can easily hide Apche (httpd) version number and other information. There are two config directives that controls Apache version. The ServerSignature directive adds a line containing the Apache HTTP Server server version and the ServerName to any server-generated documents, such as error messages sent back to clients. ServerSignature is set to on by default. The ServerTokens directive controls whether Server response header field which is sent back to clients includes a description of the generic OS-type of the server as well as information about compiled-in modules. By setting this to Prod you only displays back Apache as server name and no version number displayed back.

Open your httpd.conf file using text editor such as vi:
vi httpd.conf

Append/modify config directive as follows:
ServerSignature Off
ServerTokens Prod

Save and close the file. Restart Apache web server:
# /etc/init.d/httpd restart

Disable SELinux for only Apache / httpd in Linux

Q. How do I disable SELinux protection for only Apache web server in Linux? I'm using CentOS Linux server.
[click to continue…]

Apache redirect domain.com to www.domain.com

Q. What's the best way to redirect domain.com to www.domain.com on the url address bar whenever someone omits or skip the www from domain.com? My site can be reached by two different URLs. For example http://domain.com/about/us.html and http://www.domain.com/about/us.html

How do I do configure Apache web sever vps for this task?

A. Apache (web server) 301 redirect is the most efficient and search engine friendly method for webpage redirection. You can place following code Apache’s httpd.conf vhost section or in .htaccess file.

$ vi .htaccess
Append following config code:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L] 

Save and close the file. Above code will redirect users to www.domain.com url.

Tweaking php For Maximum Execution Time For Scripts

I've been trying to migrate my webblogs using WordPress inbuilt import facility. I've exported current blog as a xml file and downloaded to my desktop. Next I navigated to my new blog's admin area and clicked on Manage > Import. However import failed after importing 50-60% posts only.

I went through Apache and PHP log files and I realized that the script was timed out. How do I fix this problem under Linux / UNIX?
[click to continue…]