To verify httpd installed or not<\/p>\n
rpm -qa httpd\r\n(will display the package details if available)\r\n ex: httpd-2.2.15-29.el6_4.x86_64<\/pre>\nDefault Paths<\/h4>\n
\/usr\/sbin\/httpd command path\r\n\/etc\/httpd httpd root path\r\n\/etc\/httpd\/conf Main config path\r\n\/etc\/httpd\/conf.d Additional config path\r\n\/etc\/httpd\/logs Link pointed to httpd log & error log<\/pre>\n\u00a0Default log files of Apache Webserver<\/h4>\n
access_log All access details\r\nerror_log All Error Details<\/pre>\nTo re-load the config\/modules<\/p>\n
service httpd reload<\/pre>\nTo start the httpd service<\/p>\n
service httpd start<\/pre>\nTo stop the httpd service<\/p>\n
service httpd stop<\/pre>\nTo restart the httpd service<\/p>\n
service httpd restart<\/pre>\nTo check the status of the service<\/p>\n
service httpd status<\/pre>\nDefault Declarations used in the configuration file<\/h4>\n
ServerRoot Default Root location of httpd\r\nPidFile id of the initial httpd server;Because apache will create by default \r\n additional child process to handle traffic\r\nDocumentRoot File System Root Directory<\/pre>\n\n
- \u00a0All paths mentioned in the config file will be calculated from ServerRoot path (i.e) Relative path<\/li>\n
- Default error log will be calculated from the server root directory. If one wants the error log to be moved to another place, create log directory as a symbolic link to another required folder. (Ex \/var\/log\/httpd\/logs)<\/li>\n<\/ul>\n
Number of Server instances needs to be started can be set up in the below section.<\/p>\n
<IfModule prefork.c>\r\n StartServers 8\r\n MinSpareServers 5\r\n MaxSpareServers 20\r\n ServerLimit 256\r\n MaxClients 256\r\n MaxRequestsPerChild 4000\r\n<\/IfModule>\r\n\r\n# StartServers: number of server processes to start\r\n# MinSpareServers: minimum number of server processes which are kept spare\r\n# MaxSpareServers: maximum number of server processes which are kept spare\r\n# ServerLimit: maximum value for MaxClients for the lifetime of the server\r\n# MaxClients: maximum number of server processes allowed to start\r\n# MaxRequestsPerChild: maximum number of requests a server process serves<\/pre>\n\u00a0Directives<\/h4>\n
\n
- Directory tag\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0 –\u00a0\u00a0\u00a0 can be used to apply settings for particular directory.<\/li>\n
- DirectoryMatch tag \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0 \u00a0 –\u00a0\u00a0\u00a0 Same as Directory tag but we can use patterns.(i.e) setting rules for multiple directories (ex)\n
<DirectoryMatch \"^\/www\/(.+\/)?[0-9]{3}\"><\/pre>\nwould match directories in \/www\/ that consisted of three numbers.<\/li>\n
- Options FollowSymLinks\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 –\u00a0\u00a0 \u00a0Webpages under this directory can point to any files under \/ directory via symbolic link. (i.e) outside of www directoy<\/li>\n
- AllowOverride None\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0 –\u00a0\u00a0 \u00a0If set that partiular directory configuration can be overridden via .htaccess file<\/li>\n
- Order allow deny \/ deny allow\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0–\u00a0\u00a0 \u00a0The meaning is if we mentioned allow deny then first allow will be taken, then deny will be taken
\nif we mentioned deny allow then first deny will be taken then allow will be taken
\nWhat is the cause of this? For example if we give like below<\/p>\nOrder deny allow\r\nallow from all\r\ndeny from 192.168.101.100<\/pre>\nthe expectation is to deny only from 192.168.101.100. But it will allow all people. Because we gave deny at first, allow later. So allow will over write deny order<\/li>\n
- Options Indexes\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 –\u00a0\u00a0 \u00a0respond with directory listing if the index file not available. -Indexes (not allowed)\u00a0 ,+Indexes (allowed)<\/li>\n
- Files Directive \u00a0\u00a0 \u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0 \u00a0\u00a0\u00a0\u00a0 –\u00a0\u00a0 \u00a0similiar like Directory Directive; the difference is files directive is at file level where Directory directive is at directory level<\/li>\n
- FilesMatch directive\u00a0\u00a0 \u00a0 \u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 –\u00a0\u00a0 \u00a0similar like DirectoryMatch but for files<\/li>\n
- Location directive \u00a0\u00a0 \u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0–\u00a0\u00a0 \u00a0similar like Files,Directory directives; but based on url config will be applied
\n(ex)<\/p>\n<Location \/server-info>\r\nSetHandler server-info\r\nOrder deny,allow\r\nDeny from all\r\nAllow from 192.168.227.1\r\n<\/Location><\/pre>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"To verify httpd installed or not rpm -qa httpd (will display the package details if available) ex: httpd-2.2.15-29.el6_4.x86_64 Default Paths \/usr\/sbin\/httpd command path \/etc\/httpd httpd root path \/etc\/httpd\/conf Main config path \/etc\/httpd\/conf.d Additional config path \/etc\/httpd\/logs Link pointed to httpd … Continue reading