Failed to start high performance web server and reverse proxy server nginx

Discussão em 'Angular' iniciado por Jamar P, Janeiro 17, 2025.

  1. Jamar P

    Jamar P Guest

    UPDATE - I got these error logs:

    nginx: [emerg] unknown "request_url" variable
    Aug 19 01:14:58 nginx[4890]: nginx:
    configuration file /etc/nginx/nginx.conf test failed


    Here is my nginx.conf file:

    user www-data;
    worker_processes auto;
    pid /run/nginx.pid;
    include /etc/nginx/modules-enabled/*.conf;

    events {
    worker_connections 768;
    # multi_accept on;
    }

    http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript
    text/xml application/xml application/xml+rss text/javascript;

    ##
    # Virtual Host Configs
    ##


    The "request url" part of the error could be in my sites-enabled/default file in the location block near the bottom:

    server {
    listen 80 default_server;
    listen [::]:80 default_server;

    # SSL configuration
    #
    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;
    server_name www.domainname;
    ssl_certificate /etc/nginx/ssl/server.crt;
    ssl_certificate_key /etc/nginx/ssl/server.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!MD5;
    #
    # Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;

    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html;

    server_name _;

    location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ =404;

    return 301 https://www.hobyn.co$request_url;


    ORIGINAL QUESTION - I get the failed to start high performance web server and reverse proxy server when running:

    sudo /etc/init.d/nginx restart


    to restart nginx after making the server block configurations below to my /etc/nginx/sites-available/default file. My angular app is being served in /var/www/html:

    server {
    listen 80 default_server;
    listen [::]:80 default_server;

    # SSL configuration
    #
    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;
    server_name www.mydomainname;
    ssl_certificate /etc/nginx/ssl/****.crt;
    ssl_certificate_key /etc/nginx/ssl/****.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!MD5;


    location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ =404;

    return 301 https://www.mydomainname$request_url;
    }

    Continue reading...

Compartilhe esta Página