Tuesday, October 25, 2022

Nginx server block configuration for MailWizz

 server {

  #    if ($host = www.yourdomain.com) {

  #     return 301 https://$host$request_uri;

  #  } # managed by Certbot


    root /var/www/yourdomain.com/public/;

    server_name yourdomain.com www.yourdomain.com;

  # Add index.php to setup Nginx, PHP & PHP-FPM config

  # index index.php index.html index.htm index.nginx-debian.html;


    listen [::]:443 ssl ipv6only=on; # managed by Certbot

    listen 443 ssl; # managed by Certbot

    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem; # managed by Certbot

    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem; # managed by Certbot


#   ssl_certificate /etc/letsencrypt/live/www.yourdomain.com/fullchain.pem; # managed by Certbot

#    ssl_certificate_key /etc/letsencrypt/live/www.yourdomain.com/privkey.pem; # managed by Certbot

    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot

    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


  location / {

    #try_files $uri $uri/ =404;

         if (!-e $request_filename){

             rewrite ^(/)?api/.*$ /api/index.php;

         }

         if (!-e $request_filename){

             rewrite ^(/)?customer/.*$ /customer/index.php;

         }

         if (!-e $request_filename){

             rewrite ^(/)?backend/.*$ /backend/index.php;

         }

         if (!-e $request_filename){

             rewrite ^(.*)$ /index.php;

         }

         index  index.html index.htm index.php;

   }


  # pass PHP scripts on Nginx to FastCGI (PHP-FPM) server

  location ~ \.php$ {

    include snippets/fastcgi-php.conf;

    include /etc/nginx/fastcgi_params;

    # fastcgi_pass  127.0.0.1:9000;

    # fastcgi_index index.php;

    #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    #fastcgi_read_timeout 600s;

    #fastcgi_send_timeout 600s;

    # Nginx php-fpm sock config:

    fastcgi_pass unix:/run/php/php8.1-fpm.sock; #For PHP-FPM

    # Nginx php-cgi config :

    # Nginx PHP fastcgi_pass 127.0.0.1:9000;

  }


  # deny access to Apache .htaccess on Nginx with PHP, 

  # if Apache and Nginx document roots concur

  location ~ /\.ht {

    deny all;

  }

}

No comments:

Post a Comment

How to get Ranking of the Students in Excel using RANK Function

=RANK(number,ref,[order]) To rank in descending order, we will use the formula =RANK(B2,($C$5:$C$10),0) If we want unique ranks, we can use...