Redirect www and non-www http to non-www https on NGINX

16 sec read

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;
  return      301$request_uri;

# https
server {
  listen 443 ssl;

  # redirect to non-www
  if ($host = '') {
    rewrite ^/(.*)$$1 permanent;
  # others

o testing config file and restart nginx

nginx -t
nginx -s reload

Hide PHP-FPM Version on NGINX

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:...
16 sec read

Leave a Reply

Your email address will not be published. Required fields are marked *