PHP with gitlab bundled nginx not working -


i've setup gitlab using omnibus package on centos 7. i'd use gitlab server host additional websites. i've enabled custom nginx conf adding below code /etc/gitlab/gitlab.rb

nginx['custom_nginx_config'] = "include /etc/nginx/conf.d/*.conf;" 

i've created conf files in /etc/nginc/conf.d. static html files working when try run php scripts, i'm getting file not found - 404 error.

following nginx conf php :

server{     listen 80;     server_name example.com;     root /var/www/vhosts/example;     index index.php index.html index.htm;     location / {         try_files $uri $uri/ =404;     }     error_page 404 /404.html;     error_page 500 502 503 504 /50x.html;     location = /50x.html {         root /opt/gitlab/embedded/html;     }      location ~ \.php$ {         fastcgi_pass 127.0.0.1:9000;         fastcgi_index index.php;         include /opt/gitlab/embedded/conf/fastcgi_params;         fastcgi_param script_filename $document_root$fastcgi_script_name;      }  } 

the following error log:

fastcgi sent in stderr: "primary script unknown" while reading response upstream, client x.x.x.x, server: example.com, request: "get / http/1.1", upsteam: "fastcgi://127.0.0.1:9000", host: "example.com"

maybe problem comes "location ~ .php$" config.

you fix first problem gitlab omnibus included right fatscgi_params instead of default. seems comes location config.

try following code configuration :

location ~ \.php$ {    #in case maybe : /opt/gitlab/embedded/html    root  [your app directory];      try_files  $uri  $uri/  /index.php?$args;    index  index.html index.htm index.php;     fastcgi_param path_info $fastcgi_path_info;    fastcgi_param path_translated $document_root$fastcgi_path_info;    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)(/.+)$;    fastcgi_intercept_errors on;     include /opt/gitlab/embedded/conf/fastcgi_params; } 

this fix works me on debian 8 server.

hope help.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -