• Resolved andrebazaglia

    (@andrebazaglia)


    Hello,

    I run nginx and would like to set up statistics on podPress. There are three methods to do that offered by the plugin. The first one (default) is “Use WP Permalinks”, the second one is “Optional Files podpress_trac directory” and the third one is “Use download.mp3”. The two first methods requires some specific configuration on Apache, and the third method (“Use download.mp3”) may be easer to configure for me – that’s the method I would like to choose.

    The podpress asks me to configure your web server to process .mp3 files the same way it does .php files in order to get it working:

    “Use download.mp3” – This is an alternative to using an .htaccess file. This is provided for sites which run webservers that do not use the .htaccess file for configuration, such as Microsoft Internet Information Server (IIS).
    To use this option, you will need to configure your web server to process .mp3 files the same way it does .php files. This is only necessary for the podPress directory, so that the download.mp3 file will be processed as a .php file.

    So, how can I configure this on nginx? Can someone help me changing nginx configuration?

    Thanks.

    https://www.ads-software.com/extend/plugins/podpress/

Viewing 6 replies - 16 through 21 (of 21 total)
  • Thread Starter andrebazaglia

    (@andrebazaglia)

    Hi,

    Firstly, thank you very much for the attention.

    I tried to do what you told me, but than I got this when starting nginx:

    "directive "if" has no opening "{"

    Than I tried to write the config you sent me like this:

    if ($request_uri ~* "("/\/podpress_trac\/")") {
        set $w3tc_rewrite3 0;
    }

    Nginx started successfully, but I still getting 404 error in podpress links.

    Update: Now I just copied/pasted exactly what you sent me, but still not working. ??

    Any more ideas?

    Plugin Author ntm

    (@ntm)

    Using " in this code snippet is not correct and will not lead to the desired result.
    This IF condition checks with a regular expression whether the variable $request_uri contains a string which contains the phrase /podpress_trac/. All between the double quotation marks is the search phrase. Because it is a regular expression, it is necessary to escape slashes with backslashes. If one wants to search for /podpress_trac/ then the regexp is \/podpress_trac\/.

    However, please try the second variation:

    if ($request_uri ~* "podpress_trac") {
        set $w3tc_rewrite 0;
    }

    (Please, write the double quotation marks manually with your keyboard into the .conf file. Maybe there was a problem during the copy and paste process.)

    If this is helping either then a further idea could be to remove |mp3 and |m4a (and maybe other media file extensions) from line 24.

    Thread Starter andrebazaglia

    (@andrebazaglia)

    Yes, THIS WORKED!! Thank you so much.

    I removed mp3 and m4a from the extesions list from line 24 and also added the code you sent me in the config file. However, the

    if ($request_uri ~* "podpress_trac") {
        set $w3tc_rewrite 0;
    }

    is making no diference (with or without this code, the result it the same, the import is to remove mp3 and m4a from line 24). Do you recommend me to add this podpress_trac exception just for safety or as the redirect is working only removing mp3/m4a extentions, nothing else is necessary?

    Plugin Author ntm

    (@ntm)

    Do you recommend me to add this podpress_trac exception just for safety

    No. If the 404 error occurred despite using the podpress_trac exception then it is better if you do not leave this IF condition in the .conf file.

    But I have looked one more time into your .conf file and now I’m surprised that removing the file name extensions should have this effect. It seems that I was a little bit hasty with my suggestion to remove the file extensions from line 24. As I read this line now, it seems to make the server add a further line to the HTTP Header. But it is probably not the same as the exception e.g. in lines 52-54.
    On the other hand removing the file name extension seems to help.

    In conclusion remove

    if ($request_uri ~* "podpress_trac") {
        set $w3tc_rewrite 0;
    }

    But if the download does not work tomorrow then add these line again.

    Thread Starter andrebazaglia

    (@andrebazaglia)

    Nice, Tim. Thank you again. It’s great to have podPress working fine. Congratulations for your great plugin. ??

    A proper solution to this problem is to disable W3TC’s X-Powered-By header for media files altogether. This way, you don’t need to edit nginx.conf by hand each time you change a w3tc setting.

    Under “Performance” > “Browser Cache” > “Media & Other Files”, disable/uncheck “Set W3 Total Cache header”.

    Anyone using nginx + podPress + W3TC will want to do this.

Viewing 6 replies - 16 through 21 (of 21 total)
  • The topic ‘Statistics on nginx’ is closed to new replies.