Apache

How to Resolve Too many open files AH00132: file permissions deny server access

Posted on
Saw some errors in httpd log:[Sat Jun 10 18:20:54.048569 2017] [core:error] [pid 5596] (24)Too many open files: [client 123.123.123.123:56399] AH00132: file permissions deny server access: /var/www/html/logo.png, referer: http://logic.edchen.org/Check the resource limit on open files. This includes hard limit and soft limit.[root@test ~]# ulimit -H -n4096[root@test ~]# ulimit -S -n1024It could be too small to support […]
Apache

How to Make httpd.conf Take Effect Without Restart

Posted on
Since restarting httpd service may cause connections disrupted for seconds, you may use reload action instead of restart to make your httpd server apply new configuration in httpd.conf without interrupt online connections.In EL6, you can use this command:[root@test ~]# service httpd reloadIn EL7, you can use this command:[root@test ~]# systemctl reload httpd
Apache

How to Install Newest LAMP on CentOS 7.2 Minimal (2/4) – Install Apache httpd 2.4.6

Posted on
Check the version in the repository.[root@test ~]# yum info httpdLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * base: ftp.ksu.edu.tw * extras: ftp.ksu.edu.tw * updates: ftp.ksu.edu.twAvailable PackagesName        : httpdArch        : x86_64Version     : 2.4.6Release     : 40.el7.centosSize        : 2.7 MRepo        : base/7/x86_64Summary     […]
Apache

How to Prevent Visitors From Accessing Website Via Server IP

Posted on
Visitors may sometimes access your server by a pretty raw manner which contains the most specific matching IP address. For instance, suppose the server IP is 123.123.123.123, they might access the server via http://123.123.123.123/ in any browser on purpose. If there’s no website or web page in the server document root (i.e. /var/www/html), httpd will return the […]
Apache

How to Create a Negative Policy in Apache Web Server

Posted on
A common mistake that we could make is to misplace the order of Allow and Deny, which is the key to determine the behavior of access control.For example, if you want to make a negative policy to deny accesses with some explicit exceptions. The order shouldn’t be Allow,Deny:<Location /status/>    Order Allow,Deny    Deny from […]
Apache

How to Enable Dynamic robots.txt with Virtual Hosts

Posted on
The following configuration can enable the rewrite rules of your virtual hosts and make robots.txt point to any other dynamic file (e.g. robots.php or robots.asp) which can change content dynamically.Add rewrite rules into <Directory> within the Virtual host.[root@test ~]# vi /etc/httpd/conf/httpd.conf…<VirtualHost *:80>    DocumentRoot “/var/www/html/example”    ServerName www.example.com    …    <Directory “/var/www/html/example”>        […]
Apache

How to Enable Client-Side Browser Cache on Apache Web Server

Posted on
Enabling client-side browsers to cache the web pages can speed up the response time of your visitors.According to Apache HTTP server 2.2 Module mod_expires, you can add file expiration to httpd configuration.[root@localhost ~]# vi /etc/httpd/conf/httpd.conf…<IfModule mod_expires.c>    ExpiresActive On    ExpiresDefault “access plus 1 second”    ExpiresByType application/javascript “access plus 1 week”    ExpiresByType application/x-icon […]