Hide PHP-FPM Version on NGINX
Posted by blackonsole on August 12th, 2017 02:06 PM | No Comment
Check PHP-FPM version on NGINX HTTP response
$ curl -I localhost/index.php
HTTP/1.1 200 OK
Date: Sat, 12 Aug 2017 14:07:54 GMT
Content-Type: text/html
Connection: keep-alive
X-Powered-By: PHP/5.5.9-1ubuntu4.22
How to hide PHP-FPM Version (X-Powered-By:) on NGINX
vim /etc/php5/fpm/php.ini
expose_php = Off
Restart php5-fpm service
/etc/init.d/php5-fpm restart
Check the result
$ curl -I localhost/index.php
HTTP/1.1 200 ...
Hide Server Info Response on NGINX
Posted by blackonsole on August 12th, 2017 05:00 AM | No Comment
How to hide `Server:` Response info on NGINX
$ curl -I localhost
HTTP/1.1 200 OK
Server: nginx/1.4.6 (Ubuntu)
Date: Fri, 11 Aug 2017 14:09:04 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Tue, 04 Mar 2014 11:46:45 GMT
Connection: keep-alive
ETag: "5315bd25-264"
Accept-Ranges: bytes
To hide `Server:` on HTTP Response, you need install ...
Block or ban ip with NGINX
Posted by blackonsole on December 22nd, 2016 11:47 AM | No Comment
How to block ip with NGINX
0. define block ip on nginx.conf
vim /etc/nginx/nginx.conf
http {
geo $ban_ip {
default 0;
include ban_ip.conf;
}
}
that will blocked ip by clientip on access.log, if want to block ...
Redirect www and non-www http to non-www https on NGINX
Posted by blackonsole on September 3rd, 2016 12:27 PM | No Comment
How to set up redirect www and non-www http to non-www https
o nginx config file
vim /etc/nginx/sites-enabled/blackonsole.conf
# http
server {
listen 80;
server_name blackonsole.org www.blackonsole.org;
return 301 https://blackonsole.org$request_uri;
}
# https
server ...