Sponsor:

Server and Web Integrator
Link:
Kloxo-MR logo
6.5.0 or 7.0.0
Click for "How to install"
Donation/Sponsorship:
Kloxo-MR is open-source.
Donate and or Sponsorship always welcome.
Click to:
Click Here
Please login or register. 2024-04-29, 17:55:05

Author Topic: need little help with nginx config [Solved]  (Read 2134 times)

0 Members and 1 Guest are viewing this topic.

Offline weenleen

  • Junior Member
  • *
  • Posts: 20
  • Karma: +0/-0
    • View Profile
need little help with nginx config [Solved]
« on: 2015-01-12, 11:29:24 »
I have wordpress installed on domain.com , and yourls installed on domain.com/yourls
wordpress is working well but when I try to open yourls links, I get the 404 not found error of wordpress.

I can fix yourls by adding
location /yourls {
try_files $uri $uri/ /yourls/yourls-loader.php;

but then when i click on wordpress links it redirect me to yourls .

this is my default nginx.conf http://p.ngx.cc/14

how to make both Wordpress and Yourls Work together .
« Last Edit: 2015-01-12, 13:13:39 by weenleen »

Offline weenleen

  • Junior Member
  • *
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: need little help with nginx config [Solved]
« Reply #1 on: 2015-01-12, 13:17:32 »
never mind I solved it

this is the correct config for Yourls to work in sub directory. in case someone faced the same problem

Code: [Select]
### MR -- just enough remove # below for enable nginx cache
    fastcgi_cache fcache;
    #fastcgi_cache_valid 200 1h;
    #fastcgi_cache_valid 301 1h;
    #fastcgi_cache_valid 302 1h;
    #fastcgi_cache_valid any 1m;
    ## for microcache
    fastcgi_cache_valid 200 10s;
    fastcgi_cache_use_stale updating;
    fastcgi_max_temp_file_size 1M;

    fastcgi_cache_key "$scheme$request_method$host$request_uri";
    add_header X-Micro-Cache $upstream_cache_status;

    ## MR - increasing upload size to 64M (declare inside 'location /' not work
    client_max_body_size 64M;
    client_body_buffer_size 128k;

    fastcgi_connect_timeout 90s;
    fastcgi_send_timeout 90s;
    fastcgi_read_timeout 90s;
    fastcgi_buffer_size 128k;
    fastcgi_buffers 8 128k;

    ### MR -- must be using nginx with including ngx_purge_cache
    ### must be using special nginx (nginx with ngx_purge_cache include
    location ~ /purge(/.*) {
        ### MR -- just enough remove # below for enable purge_cache
        #proxy_cache_purge pcache "$scheme://$host$1$request_method";
        allow 127.0.0.1;
        deny all;
    }

    ### MR -- for userdir (access with http://ip/~user)
    location ~ ^/~(.+?)(/.*)?$ {
        if (!-f /home/$1/public_html/$2) {
            rewrite ^ 404;
        }

        alias '/home/$1/public_html$2';
        #autoindex on;
    }

    location ~ \.php$ {
try_files $uri =404;
        #include fastcgi_params;

        #fastcgi_pass                      127.0.0.1:$var_fpmport;
        fastcgi_pass                      unix:/opt/configs/php-fpm/sock/$var_user.sock;
        fastcgi_index                     index.php;

        fastcgi_param  REDIRECT_STATUS    200;
        fastcgi_split_path_info           ^(.+\.php)(/.+)$;

        fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        fastcgi_param  PATH_INFO          $fastcgi_path_info;
        fastcgi_param  PATH_TRANSLATED    $document_root$fastcgi_path_info;
 
        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/$nginx_version;
 
        fastcgi_param  REMOTE_ADDR        $remote_addr;
        fastcgi_param  REMOTE_PORT        $remote_port;
        fastcgi_param  SERVER_ADDR        $server_addr;
        fastcgi_param  SERVER_PORT        $server_port;
        fastcgi_param  SERVER_NAME        $server_name;

        fastcgi_param  PHP_ADMIN_VALUE    'sendmail_path=/usr/sbin/sendmail -t -i';
        fastcgi_param  PHP_ADMIN_VALUE    'sendmail_from=$var_domain';
    }

    location / {
        ## MR -- move to ~lxcenter.conf
        #limit_conn addr 25;

        try_files $uri $uri/ /index.php;
    }

    location /u/ {

    # Try files, then folders, then yourls-loader.php
    # --- The most important line ---
    try_files $uri $uri/ /u/yourls-loader.php;

      }

    location ~ ^/cgi-bin/.*\.(cgi|pl|py|rb) {
        gzip off;

        include fastcgi_params;

        fastcgi_pass 127.0.0.1:$var_fpmport;

        fastcgi_index cgi-bin.php;

        fastcgi_param SCRIPT_FILENAME /home/httpd/cgi-bin.php;
        fastcgi_param SCRIPT_NAME /cgi-bin/cgi-bin.php;
        #fastcgi_param X_SCRIPT_FILENAME /usr/lib$fastcgi_script_name;
        fastcgi_param X_SCRIPT_FILENAME $var_rootdir$fastcgi_script_name;
        fastcgi_param X_SCRIPT_NAME $fastcgi_script_name;
    }

    location ~ ^/cgi-bin/.*\.(cgi|pl|py|rb) {
        gzip off;

        include fastcgi_params;

        fastcgi_pass 127.0.0.1:$var_fpmport;

        fastcgi_index cgi-bin.php;

        fastcgi_param SCRIPT_FILENAME /home/httpd/cgi-bin.php;
        fastcgi_param SCRIPT_NAME /cgi-bin/cgi-bin.php;
        #fastcgi_param X_SCRIPT_FILENAME /usr/lib$fastcgi_script_name;
        fastcgi_param X_SCRIPT_FILENAME $var_rootdir$fastcgi_script_name;
        fastcgi_param X_SCRIPT_NAME $fastcgi_script_name;
    }

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: need little help with nginx config [Solved]
« Reply #2 on: 2015-01-12, 20:53:05 »
If using Kloxo-MR 7.0.0, copy /opt/configs/nginx/conf/globals/php-fpm_standard.conf to /opt/configs/nginx/conf/globals/<yourdomain>.conf and then modified it. After that, run 'sh /script/fixweb; sh /script/restart-web'.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

 


Top 4 Global Search Engines:    Google    Bing    Baidu    Yahoo
Click Here

Page created in 0.041 seconds with 18 queries.

web stats analysis