Getting NGINX to view an alias
Francis Daly
francis at daoine.org
Wed Aug 8 08:24:37 UTC 2018
On Tue, Jul 31, 2018 at 12:49:31AM -0700, Gregory Schultz wrote:
Hi there,
> I'm new at NGINX and I'm having difficulty in setting up to read an alias.
alias should work per its documentation (http://nginx.org/r/alias),
or else there is a significant bug.
What I suspect is happening here is that your "include" file has other
location{} blocks, and that one of those locations is the one chosen by
nginx to process this request.
> I'm setting up adminer on NGINX to use an alias to see a file outside of
> it's main directory. The file is called latest.php in /usr/share/adminer. I
> created a synlink to link adminer.php to latest.php. I'm trying to access
> adminer through /admin/adminer.php but returns a 404 when I try to access
> the file.
>
> my config file:
>
> server {
> listen 80;
> listen [::]:80;
> include /etc/nginx-rc/conf.d/[site]/main.conf;
> location /admin/ {
> alias /usr/share/adminer/;
> }
> }
You can show "alias" working correctly by temporarily removing that
"include" directive. All of the rest of your web site will (probably)
fail, but the request for /admin/adminer.php should return the content
of the file /usr/share/adminer/adminer.php
That output is (almost certainly) not what you want; you probably want
to proxy_pass or fastcgi_pass to a separate service to do some processing
of the php file contents.
For fastcgi, the two things you need to know are: what is the incoming
url that you want to process; and what is the name of the file that you
want to tell the fastcgi server to use. When you have those, you can
see about writing the nginx config to match it.
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list