In our hosting server from the Plesk cpanel, Nginx is configured to work as a reverse proxy engine. As I need to enable HTTP/2 that can speed up the loading time of Plesk and hosted websites. Additionally, using HTTP/2 is more secure because it makes TLS connections mandatory
When I tried to enable HTTP/2 from GUI it gave the error as:
[2018-11-15 10:47:29.068] ERR [util_exec] proc_close() failed ['/opt/psa/admin/bin/nginx_control' '--start'] with exit code [1] Can not start proxy server: /opt/psa/admin/sbin/nginx-config execution failed: nginx: [emerg] unknown log format "main" in /etc/nginx/nginx.conf:26 nginx: configuration file /etc/nginx/nginx.conf test failed
Here is my configuration of nginx.conf
file
#user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
error_log /var/log/nginx/error.log notice;
error_log /var/log/nginx/error.log info;
#pid /var/run/nginx.pid;
include /etc/nginx/modules.conf.d/*.conf;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#tcp_nodelay on;
#gzip on;
#gzip_disable "MSIE [1-6]\.(?!.*SV1)";
server_tokens off;
include /etc/nginx/conf.d/*.conf;
}
# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;
How do we Enable HTTP/2