DiscuzX 基础 Nginx 配置文件 (含 Rewrite 规则)

Kevin 杂记 15,298 次浏览 41条评论

分享一份 DiscuzX Nginx 配置文件,适用 X 系列版本,包括了伪静态 Rewrite 规则、资源缓存设置、HTTPS 重定向。只需修改其中的域名、SSL 证书路径就可以使用。要在 VPS  上零基础搭建 Discuz,首先搞定 LNMP 搭建,然后创建网站目录上传程序及配置站点 Nginx 文件就可以运行起来。

server {
    listen       80;
    listen       [::]:80;
    listen       443 ssl http2;
    listen       [::]:443 ssl http2;
    server_name  example.com;
    return 301   https://www.example.com$request_uri;

    ssl_certificate            /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key        /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_session_cache          shared:SSL:10m;
    ssl_session_timeout        5m;
    ssl_protocols TLSv1        TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers  on;
    ssl_ciphers                "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS";
    ssl_dhparam                /etc/letsencrypt/ssl-dhparams.pem;
}

server {
    listen       80;
    listen       [::]:80;
    server_name  www.example.com;
    return 301   https://www.example.com$request_uri;
}

server {
    listen       443 ssl http2;
    listen       [::]:443 ssl http2;
    server_name  www.example.com;
    root         /var/www/example.com;
    index        index.php index.html index.htm default.php default.html default.htm;

    ssl_certificate            /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key        /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_session_cache          shared:SSL:10m;
    ssl_session_timeout        5m;
    ssl_protocols TLSv1        TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers  on;
    ssl_ciphers                "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS";
    ssl_dhparam                /etc/letsencrypt/ssl-dhparams.pem;

    rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
    rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
    rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
    rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
    rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
    rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
    rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
    rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;
    rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last;
    if (!-e $request_filename) {
        return 404;
    }

    location ~ [^/]\.php(/|$) {
        try_files $uri =404;
        fastcgi_pass              127.0.0.1:9000;
        fastcgi_index             index.php;
        include                   fastcgi.conf;
        fastcgi_intercept_errors  on;
    }

    location ~ .*\.(png|jpg|jpeg|gif|bmp)$ {
        expires  30d;
    }

    location ~ .*\.(js|css)?$ {
        expires  12h;
    }

    location ~ /.well-known {
        allow all;
    }

    location ~ /\. {
        deny all;
    }
}

评论列表

  1. #1

    d3d3LnZwc2RwLm5ldA## igefewax

  2. #2

    d3d3LnZwc2RwLm5ldA## uhuulaj

  3. #3

    Hi, very nice website, cheers!
    ——————————————————
    Need cheap and reliable hosting? Our shared plans start at $10 for an year and VPS plans for $6/Mo.
    ——————————————————
    Check here: https://www.reliable-webhosting.com/

  4. #4

    Elit erkekler ben Yalova escort bayan Azra. 27 yaşında, 175
    boyunda, 55 kilo, mavi gözlü, iri göğüslü, iri kalçalı, bakır renkli saçları olan temiz eskort bayanım.

    Görüşmelerimi 4-5 yıldızlı otellerde gerçekleştiriyorum.
    Sigara ve alkol ara sıra kullanıyorum. İlişki sırasında kondom şart değil.
    Anal sex yapabiliriz. Beni sex yapan escort olarak aradığınızda da bulabilirsiniz.
    Erkeklere özel hizmetler; anal sex,yüze boşalma,geceye
    özel kıyafet. Gecelik randevu alabilirsiniz.

    yalova escort bayan

  5. #5

    Buy Kamagra Tablets Uk [url=https://cheapcialisir.com/]Cialis[/url] Achat Kamagra Sans Risque Cialis Acheter Viagra Pharmacie

  6. #6

    Canadian Pharmacy 24 Hour [url=https://buycialisuss.com/]Cialis[/url] Amoxicillin To Treat Eye Cold Cialis Comprar Cialis Generico En Barcelona

  7. #7

    This article will assist the internet visitors for creating new blog or even a weblog from start to end.

    Visit my homepage: no deposit bonus

  8. #8

    Cyproheptadine [url=https://abuycialisb.com/]generic cialis online canada[/url] Generic Drugs Buy Cialis Cialis Genericos

  9. #9

    Hi there, I discovered yiur blog by means of Google even as searching ffor a related matter, your site came up, it seems good.
    I have bookmarked it in mmy google bookmarks.
    Hi there, simply became alert to your blog thru Google, and
    found that it’s truly informative. I’m going too be careful bmw alpina for sale (tinyurl.com) brussels.
    I will appreciate should you proceed this in future. Lots oof people shall be
    benefited from your writing. Cheers!

  10. #10

    Provera Curretab [url=https://buyciallisonline.com/]Cialis[/url] Antabuse For Sale Buy Cialis Buy Avodart Online Canada

  11. #11

    [url=https://accutanne.com/]accutane pills[/url] [url=https://prednisonesr.com/]prednisone 20 mg[/url] [url=https://prednisonestrd.com/]prednisone[/url] [url=https://seroquel365.com/]seroquel xr 300 mg[/url]

  12. #12

    [url=https://trazodonemed.com/]trazodone 50 mg[/url] [url=https://sildenafilv.com/]sildenafil citrate 100mg tab[/url] [url=https://anafranilmed.com/]anafranil online india[/url] [url=https://tadalafilrem.com/]tadalafil 5mg[/url] [url=https://amoxicillinlab.com/]amoxicillin online[/url]

  13. #13

    [url=https://baclofenonline.com/]baclofen tablets[/url] [url=https://synthroidsale.com/]synthroid 0.88 mcg[/url] [url=https://lasixwtp.com/]lasix 20 mg cost[/url] [url=https://levitrav.com/]levitra cialis[/url]

  14. #14

    [url=http://amoxicillinlab.com/]amoxicillin 5[/url] [url=http://indocinrx.com/]indocin purchase[/url] [url=http://robaxinmed.com/]robaxin 1500 mg[/url] [url=http://cialissr.com/]buy cialis in singapore[/url] [url=http://anafranilmed.com/]anafranil generic[/url] [url=http://benicar24.com/]benicar medication[/url] [url=http://femalepinkviagra.com/]female pink viagra[/url] [url=http://amoxicillinzt.com/]amoxicillin 500 mg[/url] [url=http://trazodonemed.com/]trazodone hcl 100 mg[/url] [url=http://levitrav.com/]levitra 10 mg[/url]

  15. #15

    [url=http://amoxicillinlab.com/]where to buy amoxicillin[/url] [url=http://baclofenonline.com/]baclofen 10mg tablets[/url]

  16. #16

    [url=http://advairdisk.com/]advair diskus[/url] [url=http://benicar24.com/]benicar hct[/url] [url=http://trazodonemed.com/]trazodone coupon[/url] [url=http://cymbaltarx.com/]cymbalta 30 mg[/url] [url=http://kamagraed.com/]kamagra tablets online[/url] [url=http://levitrav.com/]buy levitra[/url] [url=http://prednisonesr.com/]ordering prednisone[/url] [url=http://prednisonestrd.com/]prednisone 80 mg daily[/url] [url=http://robaxinmed.com/]robaxin 500mg[/url] [url=http://tadalafilrem.com/]buy tadalafil mexico online[/url] [url=http://seroquel365.com/]seroquel xr generic[/url] [url=http://diclofenacg.com/]diclofenac gel coupon[/url] [url=http://lasixwtp.com/]lasix 20 mg pill[/url] [url=http://accutanne.com/]accutane pills[/url] [url=http://tadalafilcls.com/]best pharmacy buy tadalafil[/url] [url=http://propeciaph.com/]buy genuine propecia[/url] [url=http://synthroidsale.com/]synthroid levothyroxine[/url] [url=http://prozacflx.com/]prozac online india[/url] [url=http://amoxicillinzt.com/]where can i get amoxicillin pills[/url] [url=http://sildenafilv.com/]can you purchase sildenafil over the counter[/url]

  17. #17

    [url=http://anafranilmed.com/]anafranil 5mg[/url] [url=http://accutanne.com/]buy generic accutane[/url] [url=http://sildenafilv.com/]sildenafil 100 mg[/url] [url=http://diclofenacg.com/]where to buy diclofenac[/url] [url=http://iventolin.com/]buy ventolin[/url]

  18. #18

    [url=https://robaxinmed.com/]robaxin 500 mg tablet[/url]

  19. #19

    [url=https://levitrav.com/]generic levitra best price[/url] [url=https://prednisonesr.com/]prednisone for sale online[/url] [url=https://tadalafilrem.com/]tadalafil 75 mg[/url] [url=https://seroquel365.com/]seroquel liquid form[/url] [url=https://ampicillin24.com/]buy ampicillin[/url] [url=https://femalepinkviagra.com/]buy female viagra[/url]

  20. #20

    [url=https://iventolin.com/]buy ventolin[/url] [url=https://synthroidsale.com/]synthroid price[/url] [url=https://prednisonestrd.com/]where to buy prednisone without a prescription[/url] [url=https://femalepinkviagra.com/]pink viagra[/url] [url=https://amoxicillinlab.com/]buy amoxicillin[/url]

  21. #21

    [url=http://kamagraed.com/]where to buy kamagra[/url] [url=http://amoxicillinlab.com/]500 mg amoxicillin capsules[/url]

  22. #22

    [url=https://lasixwtp.com/]lasix water pills[/url] [url=https://diclofenacg.com/]diclofenac 50mg over the counter[/url] [url=https://amoxicillinlab.com/]amoxicillin 125 mg price[/url] [url=https://kamagraed.com/]buy kamagra[/url] [url=https://amoxicillinzt.com/]amoxicillin 500[/url] [url=https://synthroidsale.com/]synthroid 0.75[/url]

  23. #23

    [url=http://ampicillin24.com/]ampicillin for sale[/url] [url=http://trazodonemed.com/]trazodone medicine[/url] [url=http://propeciaph.com/]buy propecia[/url] [url=http://amoxicillinlab.com/]amoxicillin 500[/url] [url=http://tadalafilrem.com/]tadalafil from mexico[/url] [url=http://cialissr.com/]canadian pharmacy cialis without prescription[/url] [url=http://sildenafilv.com/]cost of 100mg sildenafil[/url] [url=http://amoxicillinzt.com/]amoxicillin 875mg[/url] [url=http://kamagraed.com/]kamagra 100 tablets[/url] [url=http://prednisonesr.com/]20 mg prednisone[/url]

  24. #24

    [url=https://baclofenonline.com/]buy baclofen online canada[/url] [url=https://tadalafilm.com/]tadalafil 20mg[/url] [url=https://indocinrx.com/]generic for indocin[/url] [url=https://benicar24.com/]benicar 40 mg tablet[/url] [url=https://amoxicillinzt.com/]amoxicillin 500mg tablets cost[/url]

  25. #25

    It’s going to be finish of mine day, except before finish I am reading
    this fantastic piece of writing to improve my know-how.

    My webpage :: Instagram video download

  26. #26

    [url=https://cymbaltarx.com/]cymbalta 30 mg capsule[/url]

  27. #27

    [url=https://kamagraed.com/]kamagra 150 mg[/url] [url=https://cialissr.com/]generic cialis pills online[/url] [url=https://diclofenacg.com/]diclofenac cream cost[/url] [url=https://ampicillin24.com/]buy ampicillin[/url] [url=https://iventolin.com/]ventolin online canada[/url]

  28. #28

    [url=http://tadalafilrem.com/]buy tadalafil mexico online[/url] [url=http://amoxicillinzt.com/]amoxicillin 500[/url]

  29. #29

    [url=http://iventolin.com/]ventolin medication[/url]

  30. #30

    [url=https://cymbaltarx.com/]cymbalta duloxetine[/url] [url=https://indocinrx.com/]indocin coupon[/url] [url=https://ampicillin24.com/]ampicillin 500[/url] [url=https://prozacflx.com/]400 mg prozac[/url] [url=https://kamagraed.com/]where can i buy kamagra gel[/url]

  31. #31

    [url=http://toradolrx.com/]toradol generic[/url] [url=http://diclofenacg.com/]diclofenac 100g gel[/url] [url=http://robaxinmed.com/]robaxin pills[/url] [url=http://ampicillin24.com/]buy ampicillin[/url] [url=http://cymbaltarx.com/]cymbalta 382[/url] [url=http://sildenafilv.com/]sildenafil 100mg[/url]

  32. #32

    I love your blog site. extremely good colors & style. Did you design this website yourself
    or did
    you employ somebody to do it for you? Plz react as I’m seeking to create my own blog site and
    would like to know where u got this from.
    lots of thanks http://archives.lametropole.com/article/arts-et-spectacles/musique/des-accents-de-tendresse-et-d-amour

  33. #33

    I enjoy your blog site. very good colors & theme.
    Did you create this site yourself or did
    you employ someone to do it for you? Plz respond as I’m looking to design my own blog and
    want to understand where u got this from. numerous thanks https://www.paulhastings.com/area/global-trade-controls/alternative-fee-arrangements

  34. #34

    I like your blog. extremely great colors & theme. Did you develop this site yourself or did
    you work with someone to do it for you? Plz react as I’m
    wanting to develop my own blog site and
    wish to know where u got this from. many thanks http://www.aytemizayt.com.tr/servis-ve-montaj-merkezleri/kocaeli-izmit-zn-acar-oto-elektrik-3

  35. #35

    I like your blog site. very great colors & style.
    Did you develop this site yourself or did
    you hire somebody to do it for you? Plz respond as I’m
    seeking to develop my own blog site and
    would like to understand where u got this from.
    many thanks http://bagnoud.blogg.org/appollinaire-max-jacob-gide-malraux-proust-vus-par-georges-gabory-a116147380

  36. #36

    Güzel ülkemizin gereksinimlerini çok iyi biliyor ve siz severlerimize yerli ve milli bir sohbet sitesinin varlığının temellerini atmış bulunuyoruz. Google arama motoruna baktığımız da bir çok sohbet odası ve sitesi ile karşı karşıya gelmekteyiz. Bir çoğu da tamamen bilinçsiz ve giren kullanıcıya ne istediğini ve kullanıcının isteklerine karşılık vermeyen, tamamen amatörce açılmış bilinçsiz siteler. http://forum.hayalsohbet.net

  37. #37

    fantastically astounding image. https://www.hilcohia.com/news/industry-presentations/docs/librariesprovider11/company-presentations/automotive-industry

  38. #38

    Some splendid pictures. Remarkable colours. https://nitrostrengthuk.com/updates/john-lewis-civil-liberties-symbol-and-also-long-time-congressman-passes-away/

  39. #39

    Also visit my webpage – secret-puss.world

  40. #40

    Porn and Masturbation can leave you desirous about intercourse on a regular basis, even at undesirable occasions.
    They may even start by agreeing with their husbands that additionally they love watching and
    after they noticed he is sexually aroused, they now interact him in real sexual intercourse in order that he can put to follow what he has simply watched.
    But that’s what makes this story completely different:
    my real love for grownup performance and for colorful cinema.

    It is so vital to defend those you love once they surf online.
    What does that mean? That does not imply they won’t attempt to have a look at web pages with inappropriate content.
    This site gives you full entry to unique content material
    and entry to 6 more sites with tons of horny mature girls
    getting fucked. Hopefully this is able to deter websites from posting
    sexual content material with out verifying consent. We hope Pornhitz will turn into one among the most important free porn video communitys on the web and in the mean time we are off to an excellent begin. Purchase a porn blocker!
    At a minimum, there are three parts to the perfect blocker that you want to ensure is
    a regular a part of no matter you purchase.

    Feel free to surf to my webpage freeflirt.site

  41. #41

    EMPFlix the ultimate porn and free porn experience with 1000’s of porn videos
    streaming live 24/7 and the most superior porn features our
    users love and use every day. You can use our superior search engine to look what you really
    want. The younger naked pussy is what you want and that’s what you finally
    get on the younger porn pics assortment. You need to keep your
    emotional stage balanced and keep your partner glad, if you want to take pleasure
    in your life. To save this phrase, you will must log in. However a technique or one other, they
    want to achieve out for help from other individuals.
    You may be stunned what yow will discover out to verify or
    not. But there are two children concerned so I will keep out of it.

    Intercourse sells. Whatever love scenes you do on movie will find yourself on someone’s site on the market as screen captures or movie clips of you bare.
    They’re as distinctive as dreams,’ says the ancient Indian guide of love.

    porneff.com

发表评论

电邮地址用于 Gravatar 头像显示,不会被公开可见。