How does one configure php, pl or cgi files is user subdirectories
on nginx ?
On 8/19/2020 5:52 PM, The Doctor wrote:
How does one configure php, pl or cgi files is user subdirectories
on nginx ?
Configuring PHP for a particular web server or OS is part of that >installation's configuration, not PHP itself. I suggest you look at
nginx documentation and/or for a group of forum related to nginx (or, in
the case of Linux, your distro may have information. You'll get much
better answers.,
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================
How does one configure php, pl or cgi files is user subdirectories
on nginx ?
The Doctor:
How does one configure php, pl or cgi files is user subdirectories
on nginx ?
<https://www.google.com/search?q=nginx+php>
--
Arno Welzel
https://arnowelzel.de
In article <hq6o2tF47j0U1@mid.individual.net>,
Arno Welzel <usenet@arnowelzel.de> wrote:
The Doctor:
How does one configure php, pl or cgi files is user subdirectories
on nginx ?
<https://www.google.com/search?q=nginx+php>
Tried that as well.
On 20/08/2020 14.57, The Doctor wrote:
In article <hq6o2tF47j0U1@mid.individual.net>,
Arno Welzel <usenet@arnowelzel.de> wrote:
The Doctor:
How does one configure php, pl or cgi files is user subdirectories
on nginx ?
<https://www.google.com/search?q=nginx+php>
Tried that as well.
There is no different of configuring userdir from configuring a normal >location. You will need to configure for each file extension.
--
//Aho
In article <hq7iefF9kf9U1@mid.individual.net>,
J.O. Aho <user@example.net> wrote:
On 20/08/2020 14.57, The Doctor wrote:
In article <hq6o2tF47j0U1@mid.individual.net>,
Arno Welzel <usenet@arnowelzel.de> wrote:
The Doctor:
How does one configure php, pl or cgi files is user subdirectories
on nginx ?
<https://www.google.com/search?q=nginx+php>
Tried that as well.
There is no different of configuring userdir from configuring a normal >>location. You will need to configure for each file extension.
did that. here is the error I am getting:
Logs:
2020/08/16 20:05:09 [error] 1971#100506: *623 FastCGI sent in stderr:
"Unable to +open primary script: /usr/home//html/~doctor/blog/serendipity/comment.php (No +such file or directory)" while reading response header from upstream, client: +46.229.168.152, server: www.nk.ca, request: "GET +/~doctor/blog/serendipity/comment.php HTTP/1.1", upstream: +"fastcgi://unix:/var/run/php-fpm.sock:", host: "www.nk.ca" 2020/08/16 20:16:20 [error] 2707#100146: *1259 FastCGI sent in stderr: "Unable +to
open primary script: /usr/home//html/~doctor/blog/serendipity/index.php
(No +such file or directory)" while reading response header from upstream, client: +116.202.106.130, server: www.nk.ca, request: "GET +/~doctor/blog/serendipity/index.php?%2Ffeeds%2Findex_rss2= HTTP/1.1", upstream: +"fastcgi://unix:/var/run/php-fpm.sock:", host: "www.nk.ca" 2020/08/16 20:22:22 [error] 2707#100146: *2014 open() +"/usr/home/doctor/html/blog/serendipity/feeds/index.rss2" failed (2: No
such +file or directory), client: 51.254.168.38, server: www.nk.ca,
request: "GET +/~doctor/blog/serendipity/feeds/index.rss2 HTTP/1.0", host: "www.nk.ca" 2020/08/16 20:22:23 [error] 2707#100146: *2028 open() +"/usr/home/doctor/html/blog/serendipity/feeds/index.rss2" failed (2: No
such +file or directory), client: 51.254.168.38, server: www.nk.ca,
request: "GET +/~doctor/blog/serendipity/feeds/index.rss2 HTTP/1.1", host: "www.nk.ca", +referrer: "http://www.nk.ca/~doctor/blog/serendipity/feeds/index.rss2"
And here is the configuration in question
location ~ ^/~(.+?)(/.*)?$ {
alias /usr/home/$1/html/$2;
index index.php index.phtml index.shtml index.html index.htm;
autoindex on;
location ~ .*~.*\.php$ {
#root html;
#try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# Mitigate https://httpoxy.org/ vulnerabilities
#fastcgi_param HTTP_PROXY "";
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
/usr/home/$1/html$fastcgi_script_name;
include /usr/local/etc/nginx/fastcgi_params;
}
}
Why am I not getting /usr/home/html/~doctor instead of
/usr/home/doctor/html ?
Consider the part that reads:...
^/~(.+?)(/.*)?$
This is meant to break the "path" part of the given URL into two components:
The
.+
says that we require one or more (+) characters of any value (.), so
.+
matches a name.
But, what does the
?
signify.
It, too, is a metacharacter, and matches a count of zero or one of the preceding character. But, there is no "preceding character" that it can
apply to. It looks /odd/ to me.
So, my suggestion is that the common instructions are incorrect, in that
the regex for $1 is malformed and won't work as expected.
You could try a slightly different regex:
^/~(.+)(/.*)?$
In comp.infosystems.www.servers.unix,
Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:
Consider the part that reads:
^/~(.+?)(/.*)?$
This is meant to break the "path" part of the given URL into two components: >...
The
.+
says that we require one or more (+) characters of any value (.), so
.+
matches a name.
But, what does the
?
signify.
In PCRE the syntax "+?" indicates the MINIMAL (non-greedy) number of the >proceeding item to satisfy context, as opposed to plain "+" being the
MAXIMAL (greedy) match. In the case of
^/~(.+?)(/.*)?$
It effectively means the first period will never match "/". In some
contexts, using non-greedy matches can have surprising results. In
particular if any of the context is multiple literal characters, when
an exact literal might not be true.[*] I try to avoid non-greedy when >possible, eg:
^/~([^/]+)(/.*)?$
But non-greedy is safe and not wrong (here), so it can be used.
It, too, is a metacharacter, and matches a count of zero or one of the
preceding character. But, there is no "preceding character" that it can
apply to. It looks /odd/ to me.
So, my suggestion is that the common instructions are incorrect, in that
the regex for $1 is malformed and won't work as expected.
You could try a slightly different regex:
^/~(.+)(/.*)?$
That will break when there are subdirectories, becuase the first + is
greedy.
Input: /~lew/have/I/got/an/example/for/you
Output: $1 = /~lew/have/I/got/an/example/for
$2 = /you
[*] One of the classic examples comes from naive parsing of HTML.
<a.*?href="(.*?)">
Works fine on input <a href="https://qaz.wtf/">
-> $1 = https://qaz.wtf/
Works fine on input <a class="link" href="https://qaz.wtf/">
-> $1 = https://qaz.wtf/
Works poorly on input <a href="https://qaz.wtf/" class="link">
-> $1 = https://qaz.wtf/" class="link
Works TERRIBLY on input
<a href="foob.html" class='link'>Ten paragraphs</a> of html
follow all without any <A> tags. And then
<a href="https://qaz.wtf/" class="link">
-> $1 = foob.html" class='link'>Ten paragraphs</a> of html
follow all without any <A> tags. And then
<a href="https://qaz.wtf/" class="link
Elijah
------
never uses user directories any more and hasn't looked at the problem here
In article <hq7iefF9kf9U1@mid.individual.net>,
J.O. Aho <user@example.net> wrote:
On 20/08/2020 14.57, The Doctor wrote:
In article <hq6o2tF47j0U1@mid.individual.net>,
Arno Welzel <usenet@arnowelzel.de> wrote:
The Doctor:
How does one configure php, pl or cgi files is user subdirectories
on nginx ?
<https://www.google.com/search?q=nginx+php>
Tried that as well.
There is no different of configuring userdir from configuring a normal
location. You will need to configure for each file extension.
did that. here is the error I am getting:
location ~ ^/~(.+?)(/.*)?$
Logs:
2020/08/16 20:05:09 [error] 1971#100506: *623 FastCGI sent in stderr: "Unable to
+open primary script: /usr/home//html/~doctor/blog/serendipity/comment.php (No
+such file or directory)" while reading response header from upstream, client:
+46.229.168.152, server: www.nk.ca, request: "GET
alias /usr/home/$1/html/$2;
Why am I not getting /usr/home/html/~doctor instead of /usr/home/doctor/html ?
location ~ .*~.*\.php$ {
#root html;
#try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# Mitigate https://httpoxy.org/ vulnerabilities
#fastcgi_param HTTP_PROXY "";
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/home/$1/html$fastcgi_script_name;
include /usr/local/etc/nginx/fastcgi_params;
}
On 21/08/2020 00.16, The Doctor wrote:
In article <hq7iefF9kf9U1@mid.individual.net>,
J.O. Aho <user@example.net> wrote:
On 20/08/2020 14.57, The Doctor wrote:
In article <hq6o2tF47j0U1@mid.individual.net>,
Arno Welzel <usenet@arnowelzel.de> wrote:
The Doctor:
We are quite off topic for c.l.p, so that why an OT in the subject.
How does one configure php, pl or cgi files is user subdirectories >>>>>> on nginx ?
<https://www.google.com/search?q=nginx+php>
Tried that as well.
There is no different of configuring userdir from configuring a normal
location. You will need to configure for each file extension.
did that. here is the error I am getting:
location ~ ^/~(.+?)(/.*)?$
Logs:
2020/08/16 20:05:09 [error] 1971#100506: *623 FastCGI sent in stderr: >"Unable to
+open primary script: /usr/home//html/~doctor/blog/serendipity/comment.php (No
+such file or directory)" while reading response header from upstream, client:
+46.229.168.152, server: www.nk.ca, request: "GET
Your regexp is incorrect, as Lew pointed out, but sadly his regexp will
have same kind of issue and even if it had been working, there had been >problem with potentially access directories that are not to ment to be >served.
The regexp you are looking for is: ^/~([\w-]*)(/.*)?$
Next time you have issues with regexp in nginx, take a look at >https://www.regextester.com/94055 and use the substitution section to
see what values you really get.
alias /usr/home/$1/html/$2;
Why am I not getting /usr/home/html/~doctor instead of >/usr/home/doctor/html ?
I don't think you should have the tilde in the directory name, if you
want to change the order, then you have to change the order in your
alias, $1 is the username, the $2 is the path, so if you have
/user/home/html directory filled with users web directories, tne you
should have /usr/home/html/$1/$2. If you need to keep the tilde in the >username, then you have to move the tilde in the regexp so it's inside
the parentheses, but I recommend against that.
location ~ .*~.*\.php$ {
#root html;
#try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# Mitigate https://httpoxy.org/ vulnerabilities
#fastcgi_param HTTP_PROXY "";
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/home/$1/html$fastcgi_script_name;
include /usr/local/etc/nginx/fastcgi_params;
}
This looks really messy and another potential error source.
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
}
that should be neater and less prone to fail.
PS. When you reply, remove the footer(s) if your news client don't
manage to remove footers by itself.
--
//Aho
You have to wonder why apache is viewed as bloatware
yet converting to nginx is not that straight forword
esp when subdirectories and php gets involed.
On 21/08/2020 15.21, The Doctor wrote:
You have to wonder why apache is viewed as bloatware
yet converting to nginx is not that straight forword
esp when subdirectories and php gets involed.
I would say they are quite different products and the aim has been
different. Apache is simple to configure the defaults while nginx gives
you a lot more freedom at the cost of more difficult configurations.
--
//Aho
In article <hqahbiFsk9oU1@mid.individual.net>,
J.O. Aho <user@example.net> wrote:
On 21/08/2020 15.21, The Doctor wrote:
You have to wonder why apache is viewed as bloatware
yet converting to nginx is not that straight forword
esp when subdirectories and php gets involed.
I would say they are quite different products and the aim has been >>different. Apache is simple to configure the defaults while nginx gives
you a lot more freedom at the cost of more difficult configurations.
--
//Aho
Well have you looks at Netcraft's Web Survey lately?
In article <hqahbiFsk9oU1@mid.individual.net>,
J.O. Aho <user@example.net> wrote:
On 21/08/2020 15.21, The Doctor wrote:
You have to wonder why apache is viewed as bloatware
yet converting to nginx is not that straight forword
esp when subdirectories and php gets involed.
I would say they are quite different products and the aim has been
different. Apache is simple to configure the defaults while nginx gives
you a lot more freedom at the cost of more difficult configurations.
--
//Aho
Well have you looks at Netcraft's Web Survey lately?
The Doctor:
In article <hqahbiFsk9oU1@mid.individual.net>,
J.O. Aho <user@example.net> wrote:
On 21/08/2020 15.21, The Doctor wrote:
You have to wonder why apache is viewed as bloatware
yet converting to nginx is not that straight forword
esp when subdirectories and php gets involed.
I would say they are quite different products and the aim has been
different. Apache is simple to configure the defaults while nginx gives
you a lot more freedom at the cost of more difficult configurations.
--
//Aho
Well have you looks at Netcraft's Web Survey lately?
What does this have to do with the question of how difficould or easy it
is to configure? nginx is not used because it is so simple to set up but >because of its performance.
--
Arno Welzel
https://arnowelzel.de
In article <hqf3g0Fqt12U1@mid.individual.net>,
Arno Welzel <usenet@arnowelzel.de> wrote:
The Doctor:
In article <hqahbiFsk9oU1@mid.individual.net>,
J.O. Aho <user@example.net> wrote:
On 21/08/2020 15.21, The Doctor wrote:
You have to wonder why apache is viewed as bloatware
yet converting to nginx is not that straight forword
esp when subdirectories and php gets involed.
I would say they are quite different products and the aim has been
different. Apache is simple to configure the defaults while nginx gives >>>> you a lot more freedom at the cost of more difficult configurations.
--
//Aho
Well have you looks at Netcraft's Web Survey lately?
What does this have to do with the question of how difficould or easy it
is to configure? nginx is not used because it is so simple to set up but
because of its performance.
And that is why the competition is on.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 365 |
Nodes: | 16 (3 / 13) |
Uptime: | 25:16:59 |
Calls: | 7,748 |
Files: | 12,888 |
Messages: | 5,740,148 |