mediawiki, php-fpm, and nginx

Anoop Alias anoopalias01 at gmail.com
Sun Sep 17 12:28:31 UTC 2017


try changing

##############################

location = /wiki {
      root /home/www/isotoperesearch.ca/wiki;
      fastcgi_index index.php;
      index index.php;
      include fastcgi_params;
      fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;

}

##############################
to

#################################

location /wiki/ {
      # root /home/www/isotoperesearch.ca/wiki;
      fastcgi_index index.php;
      index /wiki/index.php;
      include fastcgi_params;
      fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;

}

######################################3

On Sun, Sep 17, 2017 at 5:48 PM, Etienne Robillard <tkadm30 at yandex.com>
wrote:

> Hi,
>
> I'm trying to configure nginx with php-fpm to run mediawiki in a distinct
> location (/wiki).
>
> Here's my config:
>
> # configuration file /etc/nginx/nginx.conf:
> user www-data;
> worker_processes 4;
> pid /run/nginx.pid;
>
> events {
>     worker_connections 512;
>     multi_accept on;
>     use epoll;
> }
>
> http {
>
>     ##
>     # Basic Settings
>     ##
>
>     sendfile on;
>     tcp_nopush on;
>     tcp_nodelay on;
>     keepalive_timeout 80;
>     types_hash_max_size 2048;
>     # server_tokens off;
>
>     # server_names_hash_bucket_size 64;
>     # server_name_in_redirect off;
>
>     include /etc/nginx/mime.types;
>     default_type application/octet-stream;
>
>     ##
>     # SSL Settings
>     ##
>
>     ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
>     ssl_prefer_server_ciphers on;
>
>     ##
>     # Logging Settings
>     ##
>
>     access_log /var/log/nginx/access.log;
>     error_log /var/log/nginx/error.log;
>
>     ##
>     # Gzip Settings
>     ##
>
>     gzip off;
>     gzip_disable "msie6";
>
>     # gzip_vary on;
>     # gzip_proxied any;
>     # gzip_comp_level 6;
>     # gzip_buffers 16 8k;
>     # gzip_http_version 1.1;
>     # gzip_types text/plain text/css application/json
> application/javascript text/xml application/xml application/xml+rss
> text/javascript;
>
>     ##
>     # Virtual Host Configs
>     ##
>
>     #isotopesoftware.ca:
>     #include /etc/nginx/conf.d/development.conf;
>     include /etc/nginx/conf.d/isotoperesearch.conf;
>     #include /etc/nginx/sites-enabled/*;
> }
>
> server {
>
>     # static medias web server configuration, for development
>     # and testing purposes.
>
>     listen       80;
>     server_name  localhost;
>     error_log /var/log/nginx/error_log; #debug
>     root /home/www/isotoperesearch.ca;
>     #autoindex on;
>     client_max_body_size 5m;
>     client_body_timeout 60;
>
>     location / {
>     #    # host and port to fastcgi server
>         #uwsgi_pass django; # 8808=gthc.org; 8801=tm
>         #include uwsgi_params;
>         fastcgi_pass 127.0.0.1:8808;
>         include fastcgi_params;
>     }
>
>
>     # debug url rewriting to the error log
>     rewrite_log on;
>
>     location /media {
>         autoindex on;
>         gzip on;
>     }
>
>     location /pub {
>         autoindex on;
>         gzip on;
>     }
>
>     location /webalizer {
>         autoindex on;
>         gzip on;
>     #auth_basic "Private Property";
>     #auth_basic_user_file /etc/nginx/.htpasswd;
>         allow 67.68.76.70;
>     deny all;
>     }
>
>     location /documentation {
>         autoindex on;
>         gzip on;
>     }
>
>     location /moin_static184 {
>     autoindex on;
>     gzip on;
>     }
>     location /favicon.ico {
>     empty_gif;
>     }
>     location /robots.txt {
>          root /home/www/isotopesoftware.ca;
>     }
>     location /sitemap.xml {
>     root /home/www/isotopesoftware.ca;
>     }
>
>     #location /public_html {
>     # root /home/www/;
>     # autoindex on;
>     #}
>     # redirect server error pages to the static page /50x.html
>     #error_page 404 /404.html;
>     #error_page 403    /403.html;
>     #error_page 500 502 503 504  /50x.html;
>     #location = /50x.html {
>     #    root   /var/www/nginx-default;
>     #}
>
>     include conf.d/mediawiki.conf;
>     #include conf.d/livestore.conf;
> }
>
>
> # configuration file /etc/nginx/fastcgi_params:
> fastcgi_param  PATH_INFO          $fastcgi_script_name;
> fastcgi_param  QUERY_STRING       $query_string;
> fastcgi_param  REQUEST_METHOD     $request_method;
> fastcgi_param  CONTENT_TYPE       $content_type;
> fastcgi_param  CONTENT_LENGTH     $content_length;
>
> fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
> fastcgi_param  REQUEST_URI        $request_uri;
> fastcgi_param  DOCUMENT_URI       $document_uri;
> fastcgi_param  DOCUMENT_ROOT      $document_root;
> fastcgi_param  SERVER_PROTOCOL    $server_protocol;
>
> fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
> fastcgi_param  SERVER_SOFTWARE    nginx;
>
> fastcgi_param  REMOTE_ADDR        $remote_addr;
> fastcgi_param  REMOTE_PORT        $remote_port;
> #fastcgi_param  REMOTE_USER      $remote_user;
> fastcgi_param  SERVER_ADDR        $server_addr;
> fastcgi_param  SERVER_PORT        $server_port;
> fastcgi_param  SERVER_NAME        $server_name;
>
>
> #XXX
> #fastcgi_param HTTP_IF_NONE_MATCH $http_if_none_match;
> #fastcgi_param HTTP_IF_MODIFIED_SINCE $http_if_modified_since;
>
>
> # PHP only, required if PHP was built with --enable-force-cgi-redirect
> # fastcgi_param  REDIRECT_STATUS    200;
>
> fastcgi_send_timeout 90;
> fastcgi_read_timeout 90;
> fastcgi_connect_timeout 40;
> #fastcgi_cache_valid 200 304 10m;
> #fastcgi_buffer_size 128k;
> #fastcgi_buffers 8 128k;
> #fastcgi_busy_buffers_size 256k;
> #fastcgi_temp_file_write_size 256k;
>
>
> # configuration file /etc/nginx/conf.d/mediawiki.conf:
>
>
> location = /wiki {
>       root /home/www/isotoperesearch.ca/wiki;
>       fastcgi_index index.php;
>       index index.php;
>       include fastcgi_params;
>       fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
>
> }
>
> #location @mediawiki {
> #    rewrite ^/(.*)$ /index.php;
> #}
>
>
> The issue is that the default "/" location is masking the fastcgi_pass
> directive in the wiki block.
>
> Is there any ways to run php-fpm in a location block ?
>
>
> Thank you in advance,
>
> Etienne
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>



-- 
*Anoop P Alias*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20170917/b6c1a7c4/attachment.html>


More information about the nginx mailing list