programing

index.php를 실행하는 대신 nginx & php7.3-fpm 다운로드에 대한 다음 클라우드

powerit 2023. 8. 1. 20:53
반응형

index.php를 실행하는 대신 nginx & php7.3-fpm 다운로드에 대한 다음 클라우드

php7.3-fpm을 사용하여 다음 클라우드 데이터베이스를 제공하기 위해 nginx를 사용하여 cloud.redacted.xyz를 설정하려고 하지만 URL은 실행하는 대신 index.php를 다운로드해야 합니다.

다음 클라우드 구성 또는 vhost에 문제가 있습니까?어딘가에 구문 오류가 있을 것 같은데 찾을 수가 없습니다.조언을 해주셔서 미리 감사드립니다.

/etc/nginx/sites에서 V 호스트 구성 사용

upstream php-handler {
    server unix:/var/run/php/php7.3-fpm.sock;
    server 127.0.0.1:9000;
}

server {
    if ($host = cloud.redacted.xyz) {
        return 301 https://$hosts$request_uri;
    } # managed by Certbot

    listen 80;
    listen [::]:80;
    server_name cloud.redacted.xyz ;

    return 301 https://$server_name$request_uri;
}

server {
    listen 443      ssl http2;
    listen [::]:443 ssl http2;
    server_name cloud.redacted.xyz ;
    ssl_certificate     /etc/letsencrypt/live/redacted.xyz-0001/cert.pem ; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/redacted.xyz-0001/privkey.pem ; # managed by Certbot

    root /var/www/nextcloud ;

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location ^~ /.well-known {
        location = /.well-known/carddav { return 301 /nextcloud/remote.php/dav/; }
        location = /.well-known/caldav  { return 301 /nextcloud/remote.php/dav/; }

        location /.well-known/acme-challenge    { try_files $uri $uri/ =404; }
        location /.well-known/pki-validation    { try_files $uri $uri/ =404; }

        return 301 /nextcloud/index.php$request_uri;
    }

    location ^~ /nextcloud {
        client_max_body_size 512M;
        fastcgi_buffers 64 4K;

        gzip on;
        gzip_vary on;
        gzip_comp_level 4;
        gzip_min_length 256;
        gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
        gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;

        add_header Referrer-Policy                      "no-referrer"   always;
        add_header X-Content-Type-Options               "nosniff"       always;
        add_header X-Download-Options                   "noopen"        always;
        add_header X-Frame-Options                      "SAMEORIGIN"    always;
        add_header X-Permitted-Cross-Domain-Policies    "none"          always;
        add_header X-Robots-Tag                         "none"          always;
        add_header X-XSS-Protection                     "1; mode=block" always;

        fastcgi_hide_header X-Powered-By;

        index index.php index.html /nextcloud/index.php$request_uri;

        location = /nextcloud {
            if ( $http_user_agent ~ ^DavClnt ) {
                return 302 /nextcloud/remote.php/webdav/$is_args$args;
            }
        }

        location ~ ^/nextcloud/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/)    { return 404; }
        location ~ ^/nextcloud/(?:\.|autotest|occ|issue|indie|db_|console)                  { return 404; }

        location ~ \.php(?:$|/) {
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            set $path_info $fastcgi_path_info;

            try_files $fastcgi_script_name =404;

            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $path_info;
            fastcgi_param HTTPS on;

            fastcgi_param modHeadersAvailable true;
            fastcgi_param front_controller_active true;
            fastcgi_pass php-handler;

            fastcgi_intercept_errors on;
            fastcgi_request_buffering off;
        }

        location ~ \.(?:css|js|svg|gif)$ {
            try_files $uri /nextcloud/index.php$request_uri;
            expires 6M;
            access_log off;
        }

        location ~ \.woff2?$ {
            try_files $uri /nextcloud/index.php$request_uri;
            expires 7d;
            access_log off;
        }

        location /nextcloud/remote {
            return 301 /nextcloud/remote.php$request_uri;
        }

        location /nextcloud {
            try_files $uri $uri/ /nextcloud/index.php$request_uri;
        }
    }
}

여기 제 구성의 민감하지 않은 부분들이 있습니다.var/wwww/nextcloud/config에서 php

<?php
$CONFIG = array (
    'instanceid' =>
    'passwordsalt' =>
    'secret' =>
    'trusted_domains' =>
   array (
     0 => 'cloud.redacted.xyz',
   ),
    'datadirectory' => '/var/www/nextcloud/data',
    'dbtype' => 'mysql'
    'version' => '23.0.0.10'
    'overwrite.cli.url' => 'https://cloud.redacted.xyz/nextcloud'
    'dbname' => 'nextcloud',
    'dbhost' => 'localhost',
    'dbport' => '',
    'dbtableprefix' => 'oc_',
    'mysql.utf8mb4' = true,
    'dbuser' =>
    'dbpassword' =>
    'installed' => true,
)

언급URL : https://stackoverflow.com/questions/70748503/nextcloud-on-nginx-php7-3-fpm-downloading-instead-of-executing-index-php

반응형