Live Helper Chat support forum.. Forum is locked. New place for questions - Github Discussions

You are not logged in.

Announcement

#1 2018-07-30 19:18:54

burnout75
Member
Registered: 2018-07-30
Posts: 3

NGINX and sub directory

Following documentation about nginx config LHC work smooth on root direcotry.

But Im not able to make a good nginx site config to run in a sub directoty.

Tryng this base config:

[== Undefined ==]
server {
       listen          *:80;
       server_name     example.com www.example.com;
       root           /var/www/html/example.com/public_html;
	   index      index.html;
	   
	   location /lhc_directory {
			try_files $uri $uri/ /lhc_directory/index.php?q=$uri&$args;

			
			location ~ \.php$ {
				include        /etc/nginx/fastcgi_params;
				fastcgi_pass   127.0.0.1:9000;
				fastcgi_index  index.php;
				fastcgi_param  PATH_INFO          $query_string;
				fastcgi_param  SCRIPT_FILENAME /var/www/html/example.com/public_html/lhc_directory$fastcgi_script_name;
			}
			
		}
		
		location ***_directory {
				rewrite ^/lhc_directory/(.*)$ /lhc_directory/index.php?$1 last;
          }
	   
	   
	   }

nginx log report: FastCGI sent in stderr: "Unable to open primary script: /var/www/html/example.com/public_html/lhc_directory/lhc_directory/index.php (No such file or directory)

Where is my mistake? Some example to follow?

Thanks,
Carmine

Offline

#2 2018-07-30 20:21:05

PeopleInside
Administrator
From: Italy
Registered: 2014-04-10
Posts: 4,046
Website

Re: NGINX and sub directory

Hi burnout75 ,
welcome on the live helper chat forum !

I am sorry to read about issue with Nginx and LHC.
Have you tried to activate debug?


lol PeopleInside - Live helper chat - free limited forum support!
wink For commercial support or GitHub [see FAQ here]
ops If you want to support this open source project, just donate [see support page]
glasses Something wrong with the forum? [contact a superhero]

Offline

#3 2018-07-30 20:22:20

PeopleInside
Administrator
From: Italy
Registered: 2014-04-10
Posts: 4,046
Website

Re: NGINX and sub directory

Please try to check also server error logs.


lol PeopleInside - Live helper chat - free limited forum support!
wink For commercial support or GitHub [see FAQ here]
ops If you want to support this open source project, just donate [see support page]
glasses Something wrong with the forum? [contact a superhero]

Offline

#4 2018-08-07 21:05:42

burnout75
Member
Registered: 2018-07-30
Posts: 3

Re: NGINX and sub directory

With nginx config above:

Pointing on http://www.example.com/lhc_directory

[== Undefined ==]
tail -f /var/log/nginx/error.log

2018/08/07 22:50:57 [error] 26776#26776: *3 directory index of "/var/www/html/example.com/public_html/lhc_directory/" is forbidden, client: xx.xx.xxx.xxx, server: example.com, request: "GET /lhc_directory/ HTTP/1.1", host: "www.example.com"

http://www.example.com/lhc_directory/index.php

[== Undefined ==]
2018/08/07 22:55:24 [error] 26776#26776: *115 FastCGI sent in stderr: "Unable to open primary script: /var/www/html/example.com/public_html/lhc_directory/lhc_directory/index.php (No such file or directory)" while reading response header from upstream, client: xx.xx.xxx.xxx, server: example.com, request: "GET /lhc_directory/index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.example.com"

Somethin is wrong on redirect: /var/www/html/example.com/public_html/lhc_directory/lhc_directory/index.php
The right ones in the real path is /var/www/html/example.com/public_html/lhc_directory/index.php

Somebody use nginx on subdirectory to compare configs?

Last edited by burnout75 (2018-08-07 21:08:05)

Offline

#5 2018-08-07 22:12:46

PeopleInside
Administrator
From: Italy
Registered: 2014-04-10
Posts: 4,046
Website

Re: NGINX and sub directory

Sorry, I cannot help much with nginx. You can find how to configure nginx or try to look for nginx forums.


lol PeopleInside - Live helper chat - free limited forum support!
wink For commercial support or GitHub [see FAQ here]
ops If you want to support this open source project, just donate [see support page]
glasses Something wrong with the forum? [contact a superhero]

Offline

#6 2018-08-07 22:14:27

PeopleInside
Administrator
From: Italy
Registered: 2014-04-10
Posts: 4,046
Website

Re: NGINX and sub directory


lol PeopleInside - Live helper chat - free limited forum support!
wink For commercial support or GitHub [see FAQ here]
ops If you want to support this open source project, just donate [see support page]
glasses Something wrong with the forum? [contact a superhero]

Offline

#7 2018-08-18 22:18:06

burnout75
Member
Registered: 2018-07-30
Posts: 3

Re: NGINX and sub directory

After some test this config run as well from blank installation:

[== Undefined ==]
server {
       listen          *:80;
       server_name     example.com www.example.com;
       root           /var/www/html/example.com/public_html;

       location ^~ /lhc_directory {
                root /var/www/html/example.com/public_html/;
                try_files $uri $uri/ /lhc_directory/index.php?q=$uri&$args;
       
                location ~* (^(?!(?:(?!(php)).)*/(albums|bin|var|lib|cache|doc|settings|pos|modules)/).*?(index\.php|upgrade\.php)$) {
                        include fastcgi_params;
                        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                        fastcgi_pass   127.0.0.1:9000;
                        fastcgi_index index.php;
                        fastcgi_split_path_info ^(.+\.php)(/.+)$;
                }

                location ~* (normal_|thumb_|^/design|^/cache|^/var/storagetheme)(.*)\.(gif|jpe?g?|png|mp3|svg|otf|woff|eot|ttf|ogg|wav|bmp|htm|swf|css|js|swf|pdf|ico)$ {
            ## ***: add expires headers...
            # favicon is only stored in 1 dir, the design one; But browsers ask for it in the root

           if ($http_user_agent ~* "(WebReaper|wget|SiteSucker|SuperBot|Mihov Picture Downloader|TALWinHttpClient|A1 Website Download|WebCopier|Download Ninja|Microsoft URL Control|GetRight|Arachmo|MJ12bot|Gaisbot|Anonymous|Yanga|Twiceler|psbot|Irvine|Indy Library|HTTrack)" ) {
                return 403;
           }

           if ($http_referer ~* (stockingteensex.info|cbox.ws|teensos.net|dpstream.net|tagged.com|kaskus.us|gorilladatingservice.info|taringa.net|discuss.com|craigslist.org|poringa.net)) {
              return 403;
           }

           #aio on;
           directio 512;

           expires max;
           access_log        off;
           root           /var/www/html/example.com/public_html;
       }

 # Do not allow to hotlink full size images except our self and major search engines
       location ~* \.(gif|jpe?g?|png|bmp|swf|css|js|svg|otf|eot|ttf|woff|swf|mp3|ogg|wav|pdf|ico|txt)$ {
            ## ***: add expires headers...

           valid_referers none blocked server_names ~(livehelperchat.com|google.|reddit.|bing.|yahoo.);
           if ($invalid_referer) {
                 return 403;
           }

           if ($http_user_agent ~* "(WebReaper|wget|SiteSucker|SuperBot|Mihov Picture Downloader|TALWinHttpClient|A1 Website Download|WebCopier|Download Ninja|Microsoft URL Control|GetRight|Arachmo|MJ12bot|Gaisbot|Anonymous|Yanga|Twiceler|psbot|Irvine|Indy Library|HTTrack)" ) {
                    return 403;
           }

           if ($http_referer ~* (stockingteensex.info|cbox.ws|teensos.net|dpstream.net|tagged.com|kaskus.us|gorilladatingservice.info|taringa.net|discuss.com|craigslist.org|poringa.net)) {
              return 403;
           }

           #aio on;
           directio 512;

           expires max;
           root           /var/www/html/example.com/public_html;
       }

        rewrite /lhc_directory/(.*)$ /lhc_directory/index.php?/$1 last;

      }


}

Offline

Board footer