Nginx合并了两个位置

时间:2018-02-04 15:12:22

标签: nginx http-authentication

我已将大部分配置文件拆分,因此看起来像这样(简化)

example.conf

#stuff......
location / {
    try_files /wp-content/cache/supercache/$http_host/$cache_uri/index-https.html /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php ;
}
#stuff......

wordpress.conf

example.conf

到目前为止一切顺利。现在我想用http-auth

来保护example.com

所以我添加到 location / { auth_basic "Restricted Content"; auth_basic_user_file /etc/nginx/.htpasswd; } 以下内容;

nginx: [emerg] duplicate location "/" in /etc/nginx/snippets/wordpress.conf:53
nginx: configuration file /etc/nginx/nginx.conf test failed

但后来我得到了错误;

wordpress.conf

仅在此域上启用http-auth的最佳方法是什么? 我可以创建一个替代System.NotSupportedException HResult=0x80131515 Message=Enlisting in Ambient transactions is not supported. Source=System.Data.SqlClient StackTrace: at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.Open() at FSharp.Data.Sql.Providers.MSSqlServerProvider.FSharp-Data-Sql-Common-ISqlProvider-ProcessUpdates(IDbConnection con, ConcurrentDictionary`2 entities, TransactionOptions transactionOptions, FSharpOption`1 timeout) at <StartupCode$FSharp-Data-SqlProvider>.$SqlRuntime.DataContext.f@1-52(SqlDataContext __, IDbConnection con, Unit unitVar0) at FSharp.Data.Sql.Runtime.SqlDataContext.FSharp-Data-Sql-Common-ISqlDataContext-SubmitPendingChanges() at Program.main(String[] argv) in C:\Users\M_R_N\source\repos\ConsoleApp2\ConsoleApp2\Program.fs:line 34 ,但这会破坏分裂配置的想法。

0 个答案:

没有答案
相关问题