roles/nginx: Remove "enable_https" config logic

Everything is HTTPS now, whether self-signed or otherwise, so it
doesn't make sense to have a config switch for this.

Signed-off-by: Alan Orth <alan.orth@gmail.com>
This commit is contained in:
Alan Orth 2015-12-10 00:38:53 +02:00
parent 940b2720da
commit 43a7039dc9
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
2 changed files with 78 additions and 88 deletions

View File

@ -1,78 +1,73 @@
$ANSIBLE_VAULT;1.1;AES256
36313063373337656139333763643531663862343434376637333864653430646262346163623333
3438646233623466386439626331323361653930626531650a336232323836656664313338616131
36373232323466663730626136313265653331376134336139373861633530333837353366353361
3134663734316537630a393432353762653862663538613966633365393263333034616262313637
65626637333866653163313364316431343566656537346338623030363139663730313136663234
30313461646338303561363461376239303262396135353137646237373662383662316366333065
61623132356530363632393965613361373466313338656339646161343963306531393838636339
32666362323534613263366266356331333038376133616634376234623038656436633937613264
37363630353939373235653865306136623131633562306632623232366432383233393832613263
31366339316562383232646534393232653163316132373162326337366536623161333764326638
62343636633332323435363066393961333430386238393361396463626661336363363434303738
62646663373661323331633639316136636632616662376262666465313737656639343936643937
30626136323865623263383830623632666131623637623262326566383764313530613362383330
63626561306432316536393330333135663734646265623634356232643764353135383134386135
32303630393564333861323135343462656362333862623334666266323066313535346633323439
37396637323533666464386333376165393737653132633735663434646334326666323061653164
36646262383039323562356435636239336234613331633536363166333366386364333132653232
34333335616465356633656465303733653164633430373134656631653038386530613538623836
64363966303032333033396133356265333832373863646338616335366530633133333264343461
65653131393266613237346662373963393963643530623830393132343735333665313438643738
61363230353139623938633762303432666339326630306666313135346230613065613037366139
61623633616536663163646134386631643734613135303431643335653832633731626262646264
35303065383936626239336165373134326530373330663634343031393564323837393065386165
31353133393932626630306366373533656431316337353834383463343365333638316335366364
35646237376466316331623231613136383733353333656533303064353033333935316235663837
32656263636364383532656135663065393736306262306465333565636137306363313731666234
65366632373831306538333537373533326132613134316364306530373661626138363434643965
61333035383131656233343864343134303638656138356365636663326164393532646261633566
39653537663837343535323362376464356337343737313663393930306537653062303036663237
31336331633134656236616633363532373832323138633731346438653238363536636632353230
38356339303661616231326431323235663062613962613334616438613263383532653030636563
35343437623736646165646262653630396130633038363761373861346530313732326661613162
36633331383338623930633065316432653734396230376565346433343563383939343333633466
34306133623235636437643135353831616338393364353336333934343237633764343035336130
61376661373633373233663366313761616131333837303931633136373931396163663538666431
33373333643164393866663135313562646262376331323536383334306530363739386139336636
30633832656139306561366661393736633731623064316165346561366536376135656638653034
30363836613463323031363633343861316564626662363130383037383464306631353534623433
63353461313166363864393431633330616138343063343561326637363463343032666466643334
38366536626637383866383936363339646263333535663430663566323939656261646430623632
64653930363965343136653032626436626361613838343131663964656361346430383035376164
63383531336432323961633633303139313333363965353135356532383330303830343266353539
36653866353532616234653831663962616234663432633430313137656361616338383235303134
62333830636636636233633835656632313836316232623165393539666462313539616234636561
31373564613464363762373932636532666534336439623436373437306232313739383330633933
33616463666566326534656430623833613533373538326534366339313736373463346365376633
39366530663538333038666534326265653563646239363661623231613164646131616638666564
36653532346131323536623938313432633539343636333433306265653061346337663762653835
62356564656330316333646636613031633836316162663766613863386535623666363336643533
32373030326263663237303735323335633533663831373938323232336633326335333638313836
64633763363739663138626436323536373430376163623636356161393863613231353065333262
63386339663930393666663437303634353761643035613765323232366163643036653038623333
36393833333438326661306633343330326332623933346331616634383861393734623736353163
62666630363935356238306565336565316435323033343434343635633064666235323562633835
34313330376435363731316138623064313933326364333138366531383430623135393739386163
63613736383961643536396661356632623638393633646436366337613937633061303531386535
65623762356139313935323363633634663139366638343665623939656231323861303061326235
36353239646362323765313033366535313266343562333330623735363633386633666430663630
34633838643163623939316163663837363530383733613138336330303663383935326437636436
34613831396631366462366136616264313938623832636231373834363736313066343436326631
61303130313132353836373935313662313531353833316364623663316134633535393734333831
65643031376561306163316663366231326466333262643936313238383234363566383865623166
66613830343966313938326462366635656132336635633361303336663664303032623462646665
31653031386639303239383365633439613961643762633662303961353534313366306139343133
31366462383564383061306261393061383461363933646534623631656635613166386137663538
32336439393437383437386537323138373733666562323434373964343566353962623537386465
35343931323763363232343266346462346331303663356530666363613361643030336335656564
35613963643031316630663231336432653834386163313565626339336333633138396130303933
36336263316233336638303931393961366632306536626233623266616132313137356438666565
64383836383832613830653264636161396162303736646630383939306465333366633738326533
30396163346130373132663332383862366137666638353936326533346339353630363432333264
64343166356634333765326131633836313461616339653861376531353332613731313736323630
64333863333437323561623665333731633038376231316464346263356465306365313537633639
39636236336262393738653962343463636631323761626666616161386636313930396537353238
30643835323161613766383432353236636639613738383538636432333961336561626665383965
31316666326538633864343864653632383437613166666334356335316131313964393136326363
6232
34663839386438303961623833303166363933636137303961316138353461366132363034303639
3736613533333033626636323137623262653238336537660a356365356133383134386265643035
37366437626166336661643935336132663239626537333461393636323838393435626562646636
3635353236396335370a623036313838643738353332303065306261636135393135623931353436
30613434626337383764373237376564393937373364346162666636613461356634346661363530
66316464343466656130383361346438633964613135386362636230663533343633343164396132
38336662353866666135336638376238366337623765363133316438346334396234343134343062
34326535383733636366626461343665353737656431633233613036363237663037376235393135
38643765376535646639663436663232343239396361343135663035356539666362643036626133
34396636663461663865363762613338396335393834656562366338373966643037633135666235
38393136396363653936313135353463383564336333386633373736386435333636613037336362
65326636303865626234363934626164643739356439366463366234633136623863313430383965
30393462623334383764653663616237356434366365616662336562613638623038306365636662
64313064366638633864373065306262316634383630393762336434623062383139306239366230
62626633353565356265616131303436663738373632363233623865626439323038613338623034
61383261633563316630336139616161363238656263376262356638343339653865656461656131
30343339333862333963396630326631383164616563313636333231313831346635346263623564
33333962303661653132353032636264323163366663663730316564616362306661316366643831
33333238353439376333313836396338643161656363616630313531643965646634323463313965
37666132616639663663383936656265313365666333316231656361393236393465366637333465
65356565343431613931343565383238356465373330326265646261393731383839363336336131
38346465363062653930313462616238613031376138333964353733613961666333376665623931
64386134326533613637386339666433663630383633343864666330646237343836386139376332
63356338393831343431343136373235356661373361303333326136323736353964643431313932
64626333383230616135356163366330613430383136316134393335353866316366346163663234
35366434393133626463343733383435393230343863363561396136396165643039323062306563
39366630663030383862383234393661653836363835363662643561316634383363643131663039
30313231333062366638613332616461326538626538346131613839623438633832306134353061
66306633306366383735373438393133653832373465353964323430636536653165366439626534
35373664343433346263613363343963653633313739303663393966393862323735313332336639
32633837306532343665656233306563616366653630323230396437353439663565316263373939
33363263313439336562336663663034663733383730383861623062636533326336346630373739
34346435636662353934366435376536613139663230396235626139336532343338383933626163
61386331616561623164396639393138393333653636636165323330356239656138376432383332
36323436643930613038666462363230336664373166336432376433356632306136376232316137
63613061313332303766616665393832323230636132623162316632383631363630656362666236
38336433366661353438633837666230626238656234643761343466303333346333313463346530
30636664323935366331623961663164636631343934383138363330646338326330633932303736
37366165303134326265613135303563346339356232643234316130396231373336326132306631
36383136613366356130303164343131643834646634656138643130333037353462363762643439
39316230353630393335616232643961643534643735666637336435363336623961316664333231
62663538333836386137353165633638626635353161366133333131333133626337323861623739
65373436356364373533643366336362373665353065623536333231336564646335326530393034
32373232646663313431623566616436636134316330636666613464653831393663393834306237
36373239376665626265656139663038316233383034623632343362616237323964353466306434
37613730353236616238333637343936303032616135386332626664363932383733313963303565
33393265636161386563303930303834656161336162663033306564643861386364643631663335
32396637386233393239323635616135386138323335303332343733313833333763666264393266
34316361306162666165643630623963356630336138626264623665353064336431393632353036
38613230343165363163646339616133666161303438613937393864666261383564633937613464
64303639356164653862333232633734306166663330636364303231323337306135646266343266
38363163326430623664393364616532646132646662643133323435633965613739633833363631
38383865636266396234353932646438313937613035323031353339663865336261336163326530
61316361643763343230343566306263313839633266353731353037306334643863653632636237
37333533333831363233396265383762666233303632633438653536633163373239373933326238
36303234323663393532313364633137613338346436343864396538653234623165396630656431
38393433663237366539313132613733636239666133366630633235306364313838303064363561
34313961636331333666663537303362313031353936616134623536306535663462326236643165
61613136316338656231643136313137346332656631303536313663393563353239343764663631
32636161336632646538386436363130326632333463313230356639366236663435613162646164
32326234393462373736643037623032663161316533363661386433306237373338663966666631
34663433633830353034353466376236363634373961653536643135623837633261373634336665
61313261636633663837623663346539376535623365323932343332623364303161326565623866
30623365663433353132313131323261663438376362633363393237383666336663663663666639
31616431666233366364333334633432383739623835353262663463656338343330373434613736
65613933653231656438326137346632643131623538333462396338386638656334343334613966
32326465336463333861643962366332666161393666613362373632303463363936626239323562
30323531313864376237343938663032643230663133323536326638386532663163656463616331
39323262323831333732386361326365656361326231326538613638656462343636326430613366
65623538363564366133656466626338636534663162666138633262376634633863323764353934
30633366323234336636373234373266306462383061643963313838663364643939636634396232
63343330643135343639

View File

@ -1,12 +1,10 @@
{# helper variables and per-site defaults that we can't set in role defaults #}
{% set domain_name = item.domain_name %}
{% set domain_aliases = item.domain_aliases | default("") %}
{% set enable_https = item.enable_https | default("no") %}
{# assume HSTS is off unless a vhost explicitly sets it to "yes" #}
{% set enable_hsts = item.enable_hsts | default("no") %}
{% set has_wordpress = item.has_wordpress | default("no") %}
{% if enable_https == "yes" %}
# http -> https vhost
server {
listen 80;
@ -20,25 +18,22 @@ server {
rewrite ^ https://{{ domain_name }}$request_uri? permanent;
}
}
{% endif %}
server {
listen {% if enable_https == "yes" %} 443 ssl http2{% else %} 80{% endif %};
listen [::]{% if enable_https == "yes" %}:443 ssl http2{% else %}:80{% endif %};
listen 443 ssl http2;
listen [::]:443 ssl http2;
root {{ nginx_root_prefix }}/{{ domain_name }};
{# assumes you only want the main domain name listening for https #}
server_name {{ domain_name }} {% if enable_https == "no" %} {{ domain_aliases }}{% endif %};
{# will only work if the TLS cert covers the domain + aliases, like example.com and www.example.com #}
server_name {{ domain_name }} {{ domain_aliases }};
index index.php index.html;
access_log /var/log/nginx/{{ domain_name }}-access.log;
error_log /var/log/nginx/{{ domain_name }}-error.log;
{% if enable_https == "yes" %}
{% include 'https.j2' %}
{% endif %}
{% include 'https.j2' %}
{% if has_wordpress == "yes" %}
{% include 'wordpress.j2' %}
@ -72,7 +67,7 @@ server {
fastcgi_cache_bypass $http_pragma $wordpress_logged_in;
fastcgi_no_cache $http_pragma $wordpress_logged_in;
{% if enable_https == "yes" and enable_hsts == "yes" %}
{% if enable_hsts == "yes" %}
# Enable this if you want HSTS (recommended, but be careful)
# Include all subdomains and indicate to Google that we want this pre-loaded in Chrome's HSTS store
# See: https://hstspreload.appspot.com/