- edited description
NGINX SErver setup with include
Tried to set up NGINX Server using the include option.
I have set up 2 directories under /QOpenSys/etc/nginx (sites-available and sites-enabled
I created a config file call mytest.shield.local in sites-available with the following content.
server {
listen 80;
server_name mytest.shield.local;
root /www/php/htdocs/mytest;
index index.html index.php;
# pass PHP scripts to FastCGI server
location ~ \.php$ {
include /QOpenSys/etc/nginx/snippets/fastcgi-php.conf;
fastcgi_pass php;
}
location / {
try_files $uri $uri/ =404;
}
}
I then added a link in sites-enabled to that file called mytest.shield.local
In the nginx.conf file I added an include statement as follows
include /QOpenSys/etc/nginx/sites-enabled/*;
This should have loaded the server config in the appropriate place. However when I run the server I do not get any content served? If I remove the include statement and paste in the same content as the mytest.shield.local file it serves the content as expected.
Comments (7)
-
-
@Chris Hird , sorry for the lack of response on this. Are you still stuck on this?
-
-
assigned issue to
-
assigned issue to
-
Account Deactivated I can not recreate the issue with nginx version: nginx/1.15.2 --
- Create the symbolic link
[xumeng@ut25bp17 nginx]$ ls -l sites-enabled/ total 4 lrwxrwxrwx 1 xumeng 0 110 Mar 21 08:21 mytest.shield.local -> /QOpenSys/etc/nginx/sites-available/mytest.shield.local
- Include
sites-enabled/mytest.shield.local
intest.conf
but a wrong place. Obivously nginx finds the physical file of the symbolic link and detects the error.
[xumeng@ut25bp17 nginx]$ nginx -c ./test.conf nginx: [emerg] "server" directive is not allowed here in /QOpenSys/etc/nginx/sites-enabled/mytest.shield.local:1
- Put the
include /QOpenSys/etc/nginx/sites-enabled/*;
directive in the right place and rerun nginx. The page can be served correctly at port 12580.
cat test.conf html { include /QOpenSys/etc/nginx/sites-enabled/*; server { #listen 12580; } cat sites-available/mytest.shield.local server { listen 12580; }
-
Account Deactivated Also tested with the latest
nginx version: nginx/1.16.1
, still no problem.So nginx could find the real path of symbolic links. Maybe it is a configuration context issue?
-
reporter Sorry I have removed the setup sometime ago due to this and other issues. When I get time I will get back to testing again and update the problem. If you wish you can close this out and I will re-open should it be necessary..
-
- changed status to resolved
Thanks for reporting, but this issue may be fixed in the latest builds. Please reopen if needed.
- Log in to comment