Location and rewrite in Apache for Windows

Discussion in 'Apache' started by Janaboy, Aug 2, 2017.

  1. #2
    Hi All,

    I'm not an expert to setting up Apache, but i would like to do it.
    I have wrapper script from here:
    https://github.com/andr68rus/miwifiradio
    And i would like to set this in Apache, but i'm not familiar with rewrite and locations.
    Can you please help me how can i do it?
    Thank you in advance:

    The code is:
    server {
    listen 192.168.1.1:80;
    server_name vpsXX.ximiraga.ru api.ximalaya.com;
    root /zdata/www/miradio;
    index index.php index.html index.htm;
    // access_log /var/log/nginx/radio_access.log;
    // error_log /var/log/nginx/radio_error.log;
    location @ximalaya {
    proxy_pass http:*/api.ximalaya.com;
    }

    location / {
    rewrite ^/(.*).m3u8 /play.php?xid=$1;
    try_files $uri $uri/ @ximalaya;
    location /openapi-gateway-app/live/radios {
    try_files $uri $uri/ /index.php;
    }
    location /openapi-gateway-app/live/get_radios_by_ids {
    try_files $uri $uri/ /index.php;
    }

    location /openapi-gateway-app/search/radios {
    try_files $uri $uri/ /index.php;
    }

    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
    expires max;
    }

    location ~ [^/]\.php(/|$) {
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    if (!-f $document_root$fastcgi_script_name) {
    return 404;
    }

    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include /usr/local/etc/nginx/fastcgi_params;
    }
    }

    location ~* "/\.(htaccess|htpasswd)$" {
    deny all;
    return 404;
    }

    }
     
    Last edited by a moderator: Aug 2, 2017
    Janaboy, Aug 2, 2017 IP