Get the most out of your Centmin Mod LEMP stack
Become a Member

Vanilla Vanilla Forum with nginx config

Discussion in 'Forum software usage' started by fullclick, Jun 24, 2021.

  1. fullclick

    fullclick New Member

    11
    2
    3
    Jun 24, 2021
    CASINO ONLINE UY TÍN 247
    Ratings:
    +3
    Local Time:
    11:35 PM
    1.21
    10.3
    Dear Admin
    I'm a newbie. I dont know coding. This is the first time i build the VPS and i was installed Centminmod
    I have some problems with URL Address of Vanilla Forum
    All links are 404 page exclude homepage

    Vanilla Forum's Admin show the way to fix
    Redirect Loop on Vanilla 3.3 / Nginx
    Add these into nginx configuration
    Code:
    server {
           listen 80;
           server_name develop.vanilla.loc;
    
           root /home/rj/Develop/www/vanilla/develop;
    
       index index.php;
    
       # Block some folders as an extra hardening measure.
       location ~* /\.git { deny all; return 403; }
       location /build/ { deny all; return 403; }
       location /cache/ { deny all; return 403; }
       location /cgi-bin/ { deny all; return 403; }
       location /uploads/import/ { deny all; return 403; }
       location /conf/ { deny all; return 403; }
       location /tests/ { deny all; return 403; }
       location /vendor/ { deny all; return 403; }
    
       # This handles all the main requests thru index.php.
       location ~* ^/index\.php(/|$) {
           # send to fastcgi
           include fastcgi.conf;
           # fastcgi_param SCRIPT_NAME /index.php;
           # fastcgi_param SCRIPT_FILENAME $realpath_root/index.php;
    
    fastcgi_split_path_info      ^(.+\.php)(.*)$;
    # fastcgi_param SCRIPT_FILENAME /path/to/php$fastcgi_script_name;
    # fastcgi_param SCRIPT_NAME /index.php;
           fastcgi_param SCRIPT_NAME /index.php;
           fastcgi_param SCRIPT_FILENAME $realpath_root/index.php;
    fastcgi_param PATH_INFO      $fastcgi_path_info;
    
           fastcgi_param X_REWRITE 1;
                   fastcgi_pass unix:/run/php/php7.4-fpm.sock;
       }
       # If this is some other PHP script, disallow it by redirecting to /index.php
       location ~* \.php(/|$) {
           rewrite ^ /index.php$uri last;
       }
    
       # Default path handling
       location / {
           try_files $uri @vanilla;
       }
    
       location @vanilla {
           rewrite ^ /index.php$uri last;
       }
    
    }
    
    My domain is fullclick.net and i added these code into fullclick.net.conf like this
    Code:
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    
    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    #server {
    #            listen   80;
    #            server_name fullclick.net;
    #            return 301 $scheme://www.fullclick.net$request_uri;
    #       }
    server {
           listen 80;
           server_name fullclick.net;
    
           root /home/nginx/domains/fullclick.net;
    
       index index.php;
    
       # Block some folders as an extra hardening measure.
       location ~* /\.git { deny all; return 403; }
       location /build/ { deny all; return 403; }
       location /cache/ { deny all; return 403; }
       location /cgi-bin/ { deny all; return 403; }
       location /uploads/import/ { deny all; return 403; }
       location /conf/ { deny all; return 403; }
       location /tests/ { deny all; return 403; }
       location /vendor/ { deny all; return 403; }
    
       # This handles all the main requests thru index.php.
       location ~* ^/index\.php(/|$) {
           # send to fastcgi
           include fastcgi.conf;
           # fastcgi_param SCRIPT_NAME /index.php;
           # fastcgi_param SCRIPT_FILENAME $realpath_root/index.php;
    
    fastcgi_split_path_info      ^(.+\.php)(.*)$;
    # fastcgi_param SCRIPT_FILENAME /path/to/php$fastcgi_script_name;
    # fastcgi_param SCRIPT_NAME /index.php;
           fastcgi_param SCRIPT_NAME /index.php;
           fastcgi_param SCRIPT_FILENAME $realpath_root/index.php;
    fastcgi_param PATH_INFO      $fastcgi_path_info;
    
           fastcgi_param X_REWRITE 1;
                   fastcgi_pass unix:/run/php/php7.4-fpm.sock;
       }
       # If this is some other PHP script, disallow it by redirecting to /index.php
       location ~* \.php(/|$) {
           rewrite ^ /index.php$uri last;
       }
    
       # Default path handling
       location / {
           try_files $uri @vanilla;
       }
    
       location @vanilla {
           rewrite ^ /index.php$uri last;
       }
    
    }
    
    server {
     
      server_name fullclick.net www.fullclick.net;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      #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 Permissions-Policy "accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), usb=()";
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/fullclick.net/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/fullclick.net/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/fullclick.net/autoprotect-fullclick.net.conf;
      root /home/nginx/domains/fullclick.net/public;
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      #include /usr/local/nginx/conf/cloudflare.conf;
      include /usr/local/nginx/conf/503include-main.conf;
    
      # prevent access to ./directories and files
      #location ~ (?:^|/)\. {
      # deny all;
      #}
    
      location / {
      include /usr/local/nginx/conf/503include-only.conf;
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # Shows file listing times as local time
      #autoindex_localtime on;
    
      # Wordpress Permalinks example
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
      }
    
      include /usr/local/nginx/conf/php.conf;
     
      include /usr/local/nginx/conf/pre-staticfiles-local-fullclick.net.conf;
      include /usr/local/nginx/conf/pre-staticfiles-global.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
    
    
    After save file i checked by command "nginx -t"
    It's show
    Code:
    nginx: [warn] conflicting server name "fullclick.net" on 0.0.0.0:80, ignored
    nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
    
    #service nginx restart
    Restarting nginx (via systemctl): [ OK ]


    URL still error. Please help me check it
    Thank you
     
    Last edited: Jun 24, 2021
  2. eva2000

    eva2000 Administrator Staff Member

    50,928
    11,808
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,267
    Local Time:
    2:35 AM
    Nginx 1.25.x
    MariaDB 10.x
    But this is just a warning and not an error - difference is nginx will still restart/run with warnings while errors it won't start/run.

    The warning is due to duplicate server {} context as you have first with listen 80; directive and 2nd without a listen directive which defaults to listen 80 anyway. Essentially you listed 2 server{} contexts with same listen 80 non-HTTPS config. You don't need the first serve{} context so remove all of
    Code (Text):
    server {
          listen 80;
          server_name fullclick.net;
    
          root /home/nginx/domains/fullclick.net;
    
       index index.php;
    
       # Block some folders as an extra hardening measure.
       location ~* /\.git { deny all; return 403; }
       location /build/ { deny all; return 403; }
       location /cache/ { deny all; return 403; }
       location /cgi-bin/ { deny all; return 403; }
       location /uploads/import/ { deny all; return 403; }
       location /conf/ { deny all; return 403; }
       location /tests/ { deny all; return 403; }
       location /vendor/ { deny all; return 403; }
    
       # This handles all the main requests thru index.php.
       location ~* ^/index\.php(/|$) {
          # send to fastcgi
          include fastcgi.conf;
          # fastcgi_param SCRIPT_NAME /index.php;
          # fastcgi_param SCRIPT_FILENAME $realpath_root/index.php;
    
    fastcgi_split_path_info      ^(.+\.php)(.*)$;
    # fastcgi_param SCRIPT_FILENAME /path/to/php$fastcgi_script_name;
    # fastcgi_param SCRIPT_NAME /index.php;
          fastcgi_param SCRIPT_NAME /index.php;
          fastcgi_param SCRIPT_FILENAME $realpath_root/index.php;
    fastcgi_param PATH_INFO      $fastcgi_path_info;
    
          fastcgi_param X_REWRITE 1;
                  fastcgi_pass unix:/run/php/php7.4-fpm.sock;
       }
       # If this is some other PHP script, disallow it by redirecting to /index.php
       location ~* \.php(/|$) {
          rewrite ^ /index.php$uri last;
       }
    
       # Default path handling
       location / {
          try_files $uri @vanilla;
       }
    
       location @vanilla {
          rewrite ^ /index.php$uri last;
       }
    
    }
    

    and only edit/modifying the second server{} context with relevant vanilla config sections as outlined at Vanilla - Vanilla Forums 2.5.1+ vhost Configuration and Vanilla - Vanilla Forums 2.5.1+ vhost Configuration
     
  3. fullclick

    fullclick New Member

    11
    2
    3
    Jun 24, 2021
    CASINO ONLINE UY TÍN 247
    Ratings:
    +3
    Local Time:
    11:35 PM
    1.21
    10.3
    Thank you very much. I was following this topic first time vanilla 2.5.1 forums + centmin mod 123.09beta01 nginx 1.13.10 + php-fpm 7.1.15 + mariadb 10.1.31 + csf firewall + centos 7.4 on 2GB OpenVZ 2cpu E5-1650v3 VPS
    It ran
     
  4. fullclick

    fullclick New Member

    11
    2
    3
    Jun 24, 2021
    CASINO ONLINE UY TÍN 247
    Ratings:
    +3
    Local Time:
    11:35 PM
    1.21
    10.3