- lovees2017-08-01高级会员84634
- 本帖最后由 lovees 于 2017-8-1 09:12 编辑 *
一直没找到AMH FOR Nextcloud的配置和静态规则,花点时间自己配置了一个
- server
- {
- listen 80;
- server_name 你的域名; #server_name end
- #--------301 BEGIN
- if ($server_port = 80) {
- return 301 https://$server_name$request_uri;
- }
- if ($scheme = http) {
- return 301 https://$server_name$request_uri;
- }
- error_page 497 https://$server_name$request_uri;
- #--------301 END
- index index.html index.htm index.php; #index end
- - set $subdomain '';
- root /home/wwwroot/你自己的空间路径/web$subdomain;
- include rewrite/规则.conf; #rewrite end
- - #error_page
- error_page 400 /ErrorPages/400.html;
- error_page 403 /ErrorPages/403.html;
- error_page 404 /ErrorPages/404.html;
- error_page 502 /ErrorPages/502.html;
- location ~ /ErrorPages/(400|401|403|404|405|502|503)\.html$
- {
- root /home/wwwroot/你自己的空间路径/web;
- }
- ##############此处注译掉############
- #location ~ \.php(?:$|/)
- #location ~ .*\.php$
- #{
- # fastcgi_pass unix:/tmp/php-cgi-Aadmin.sock;#注意此处php-cgi-Aadmin.sock 在规则里面需要使用
- # fastcgi_index index.php;
- # include fcgi-host.conf;
- # fastcgi_param DOCUMENT_ROOT /web$subdomain;
- # fastcgi_param SCRIPT_FILENAME /web$subdomain$fastcgi_script_name;
- #}
- 省略................}复制代码
静态规则
- gzip off;
- add_header X-Content-Type-Options nosniff;
- add_header X-XSS-Protection "1; mode=block";
- add_header X-Robots-Tag none;
- add_header X-Download-Options noopen;
- add_header X-Permitted-Cross-Domain-Policies none;
- - location = /robots.txt {
- allow all;
- log_not_found off;
- access_log off;
- }
- location = /.well-known/carddav {
- return 301 $scheme://$host/remote.php/dav;
- }
- location = /.well-known/caldav {
- return 301 $scheme://$host/remote.php/dav;
- }
- location / {
- rewrite ^ /index.php$uri;
- }
- - location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
- deny all;
- }
- location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
- deny all;
- }
- location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
- fastcgi_split_path_info ^(.+\.php)(/.*)$;
- include fcgi-host.conf;
- fastcgi_param DOCUMENT_ROOT /web$subdomain;
- fastcgi_param SCRIPT_FILENAME /web$subdomain$fastcgi_script_name;
- fastcgi_param PATH_INFO $fastcgi_path_info;
- fastcgi_param HTTPS on;
- #Avoid sending the security headers twice
- fastcgi_param modHeadersAvailable true;
- fastcgi_param front_controller_active true;
- fastcgi_pass unix:/tmp/php-cgi-Aadmin.sock; 注意此处php-cgi-Aadmin.sock 在规则里面需要使用
- fastcgi_intercept_errors on;
- fastcgi_request_buffering off;
- }
- location ~ ^/(?:updater|ocs-provider)(?:$|/) {
- 省略................
- } 复制代码
详情或直接下载规则请到此:https://www.sxsay.net/787.html