Learn about Centmin Mod LEMP Stack today
Register Now

BeLink Lavarel Nginx Conf

Discussion in 'Other Web Apps usage' started by pdinh97qng, Jul 5, 2020.

  1. pdinh97qng

    pdinh97qng Member

    90
    10
    8
    Jan 24, 2016
    Ratings:
    +27
    Local Time:
    7:22 PM
    Hi, I have a problem with nginx conf with BeLink script, the developers did give us an example of nginx conf, but I can't make it work on Centmin MOD. Thank you!
    Example:
    Code:
    server {
        listen 80 default_server;
        server_name default;
        root /domains/site.com/public
    
        index index.html index.htm index.php;
    
        charset utf-8;
    
        location / {
            try_files $uri $uri/ /index.php?$query_string;
        }
    
        location = /favicon.ico { access_log off; log_not_found off; }
        location = /robots.txt  { access_log off; log_not_found off; }
    
        access_log off;
        error_log  /var/log/nginx/default-error.log error;
    
        error_page 404 /index.php;
    
        location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
        }
    
        location ~ /\.ht {
            deny all;
        }
    }
    Mine:
    Code:
    server {
        server_name url.abc.xyz www.url.abc.xyz;
        return 301 https://url.abc.xyz$request_uri;
        include /usr/local/nginx/conf/staticfiles.conf;
    }
    server {
        server_name url.abc.xyz www.url.abc.xyz;
        include /usr/local/nginx/conf/ssl/url.abc.xyz/url.abc.xyz.crt.key.conf;
        include /usr/local/nginx/conf/ssl_include.conf;
        ssl_client_certificate /usr/local/nginx/conf/ssl/cloudflare/url.abc.xyz/origin.crt;
        ssl_verify_client on;
        http2_max_field_size 16k;
        http2_max_header_size 32k;
        http2_max_requests 50000;
        ssl_ciphers TLS13-AES-128-GCM-SHA256:TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS;
        ssl_prefer_server_ciphers on;
        #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
        #add_header X-Frame-Options SAMEORIGIN;
        add_header X-Xss-Protection "1; mode=block" always;
        add_header X-Content-Type-Options "nosniff" always;
        #add_header Referrer-Policy "strict-origin-when-cross-origin";
        #add_header Feature-Policy "accelerometer 'none'; camera 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; payment 'none'; usb 'none'";
        #spdy_headers_comp 5;
        ssl_buffer_size 1369;
        ssl_session_tickets on;
        #resolver 8.8.8.8 8.8.4.4 1.1.1.1 1.0.0.1 valid=10m;
        #resolver_timeout 10s;
        #limit_conn limit_per_ip 16;
        #ssi on;
        access_log /home/nginx/domains/url.abc.xyz/log/access.log combined buffer=256k flush=5m;
        error_log /home/nginx/domains/url.abc.xyz/log/error.log;
        #include /usr/local/nginx/conf/autoprotect/url.abc.xyz/autoprotect-url.abc.xyz.conf;
        root /home/nginx/domains/url.abc.xyz/public;
        include /usr/local/nginx/conf/cloudflare.conf;
        include /usr/local/nginx/conf/503include-main.conf;
        location / {
            include /usr/local/nginx/conf/503include-only.conf;
            #include /usr/local/nginx/conf/block.conf;
            try_files $uri $uri/ /index.php?$query_string;
        }
        location ~ /\.ht {
            deny all;
        }
      include /usr/local/nginx/conf/pre-staticfiles-local-url.abc.xyz.conf;
      include /usr/local/nginx/conf/pre-staticfiles-global.conf;
      #include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/phpalt.conf;
     
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
    

     
  2. eva2000

    eva2000 Administrator Staff Member

    44,731
    10,196
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,804
    Local Time:
    12:22 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    you already have it setup with location / context having
    Code (Text):
    try_files $uri $uri/ /index.php?$query_string;
    

    and your /usr/local/nginx/conf/phpalt.conf in place for equivalent location .php context

    similar to How to install Laravel? Just your root path at
    Code (Text):
    root /home/nginx/domains/url.abc.xyz/public;
    needs to be the Laravel public path
     
  3. pdinh97qng

    pdinh97qng Member

    90
    10
    8
    Jan 24, 2016
    Ratings:
    +27
    Local Time:
    7:22 PM
    Thanks to clarify this, I really don't know that we the path for lavarel is different than usual.