Procházet zdrojové kódy

Subsonic converted to nginx

Bob Mottram před 10 roky
rodič
revize
037f801270
1 změnil soubory, kde provedl 11 přidání a 263 odebrání
  1. 11
    263
      beaglebone.txt

+ 11
- 263
beaglebone.txt Zobrazit soubor

@@ -7190,15 +7190,9 @@ editor /etc/nginx/sites-available/$HOSTNAME
7190 7190
 Delete all existing contents then add the following:
7191 7191
 
7192 7192
 #+BEGIN_SRC: bash
7193
-upstream subsonicbackend {
7194
-    server 127.0.0.1:4040 max_fails=3 fail_timeout=30s;
7195
-    server 127.0.0.1:4040 max_fails=3 fail_timeout=60s;
7196
-    server 127.0.0.1:4040 max_fails=3 fail_timeout=90s;
7197
-}
7198
-
7199 7193
 server {
7200 7194
     listen 80;
7201
-    server_name mysubsonicdomainname.com;
7195
+    server_name tunes.us.to;
7202 7196
     rewrite ^ https://$server_name$request_uri? permanent;
7203 7197
 }
7204 7198
 
@@ -7209,8 +7203,8 @@ map $http_upgrade $connection_upgrade {
7209 7203
 
7210 7204
 server {
7211 7205
     listen 443 ssl;
7212
-    server_name mysubsonicdomainname.com;
7213
-    index index.php;
7206
+    server_name tunes.us.to;
7207
+    index index.html index.htm;
7214 7208
 
7215 7209
     error_log  /var/www/mysubsonicdomainname.com/error.log debug;
7216 7210
 
@@ -7222,84 +7216,19 @@ server {
7222 7216
     ssl_prefer_server_ciphers on;
7223 7217
     ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # not possible to do exclusive
7224 7218
     ssl_ciphers 'EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:+CAMELLIA256:+AES256:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!ECDSA:CAMELLIA256-SHA:AES256-SHA:CAMELLIA128-SHA:AES128-SHA';
7225
-    add_header Strict-Transport-Security "max-age=0;";
7226
-    # Only uncomment one of the Strict-Transport-Security entries if you are
7227
-    # not using a self-signed certificate
7228
-    # add_header Strict-Transport-Security max-age=15768000; # six months
7229
-    # use this only if all subdomains support HTTPS!
7230
-    # add_header Strict-Transport-Security "max-age=15768000; includeSubDomains";
7219
+    #add_header Strict-Transport-Security max-age=0; # six months
7231 7220
 
7232
-    client_max_body_size 6m;
7221
+    client_max_body_size 20M;
7233 7222
 
7234 7223
     keepalive_timeout 75 75;
7235 7224
     gzip_vary off;
7236 7225
 
7237 7226
     location / {
7238
-        proxy_pass https://subsonicbackend;
7239
-        proxy_http_version 1.1;
7240
-        proxy_redirect off;
7241
-        proxy_set_header Upgrade $http_upgrade;
7242
-        proxy_set_header Connection $connection_upgrade;
7243
-        proxy_set_header Host $http_host;
7244
-        proxy_set_header X-Real-IP $remote_addr;
7245
-        proxy_buffers 16 32k;
7246
-    }
7247
-}
7248
-
7249
-
7250
-
7251
-
7252
-server {
7253
-    listen 443 ssl;
7254
-    server_name mysubsonicdomainname.com;
7255
-    charset utf-8;
7256
-
7257
-    root /var/www/mysubsonicdomainname.com/htdocs;
7258
-    index index.php;
7259
-
7260
-    if ( !-d $request_filename ) {
7261
-        rewrite ^/rest/(.*).view$ /rest/index.php?action=$1 last;
7262
-    }
7263
-
7264
-    if ( !-d $request_filename ) {
7265
-        rewrite ^/plex/(.*)$ /plex/index.php?action=$1 last;
7266
-    }
7267
-
7268
-    location /rest {
7269
-        limit_except GET POST {
7270
-            deny all;
7271
-        }
7272
-    }
7273
-
7274
-    location /plex {
7275
-        limit_except GET POST {
7276
-            deny all;
7277
-        }
7278
-    }
7279
-
7280
-    location ^~ /bin/ {
7281
-        deny all;
7282
-        return 403;
7283
-    }
7284
-
7285
-    location ^~ /config/ {
7286
-        deny all;
7287
-        return 403;
7288
-    }
7289
-
7290
-    location / {
7291
-        limit_except GET POST HEAD{
7292
-            deny all;
7293
-        }
7294
-    }
7295
-
7296
-    location ~ ^(.+\.php)(.*)$ {
7297
-        try_files $fastcgi_script_name =404;
7298
-        fastcgi_split_path_info  ^(.+\.php)(.*)$;
7299
-        fastcgi_pass   unix:/var/run/php5-fpm.sock;
7300
-        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
7301
-        fastcgi_param  PATH_INFO        $fastcgi_path_info;
7302
-        include        /etc/nginx/fastcgi_params;
7227
+        proxy_pass http://localhost:4040/;
7228
+        proxy_redirect     http://             https://;
7229
+        proxy_set_header   Host                $host;
7230
+        proxy_set_header   X-Real-IP           $remote_addr;
7231
+        proxy_set_header   X-Forwarded-For     $proxy_add_x_forwarded_for;
7303 7232
     }
7304 7233
 }
7305 7234
 #+END_SRC
@@ -7307,193 +7236,12 @@ server {
7307 7236
 Save and exit.
7308 7237
 
7309 7238
 #+BEGIN_SRC: bash
7239
+export HOSTNAME=mysubsonicdomainname.com
7310 7240
 sed "s/mysubsonicdomainname.com/$HOSTNAME/g" /etc/nginx/sites-available/$HOSTNAME > /tmp/website
7311 7241
 cp -f /tmp/website /etc/nginx/sites-available/$HOSTNAME
7312 7242
 /etc/init.d/nginx reload
7313 7243
 #+END_SRC
7314 7244
 
7315
-
7316
-
7317
-
7318
-
7319
-
7320
-
7321
-
7322
-
7323
-
7324
-
7325
-
7326
-
7327
-#+BEGIN_SRC: bash
7328
-export HOSTNAME=mysubsonicdomainname.com
7329
-editor /etc/apache2/sites-available/$HOSTNAME
7330
-#+END_SRC
7331
-
7332
-Add the following, replacing /mysubsonicdomainname.com/ with your subsonic domain name and /myusername@mydomainname.com/ with your email address.
7333
-
7334
-#+BEGIN_SRC: bash
7335
-<VirtualHost *:80>
7336
-    ServerName mysubsonicdomainname.com
7337
-    Redirect permanent / https://mysubsonicdomainname.com/
7338
-</VirtualHost>
7339
-
7340
-<IfModule mod_ssl.c>
7341
-<VirtualHost *:443>
7342
-    ServerAdmin myusername@mydomainname.com
7343
-    ServerName mysubsonicdomainname.com
7344
-
7345
-    ProxyRequests Off
7346
-    ProxyPreserveHost Off
7347
-
7348
-    <Location />
7349
-        ProxyPass  http://localhost:4040/
7350
-        ProxyPassReverse  http://localhost:4040/
7351
-    </Location>
7352
-
7353
-    RewriteEngine on
7354
-    RewriteOptions inherit
7355
-
7356
-    DocumentRoot /var/www/mysubsonicdomainname.com/htdocs
7357
-    <Directory />
7358
-        Options FollowSymLinks
7359
-        AllowOverride All
7360
-    </Directory>
7361
-    <Directory /var/www/mysubsonicdomainname.com/htdocs/>
7362
-        Options All
7363
-        AllowOverride All
7364
-        Order allow,deny
7365
-        allow from all
7366
-        LimitRequestBody 5120000
7367
-    </Directory>
7368
-
7369
-    # Don't serve .php~ or .php# files created by emacs
7370
-    <Files ~ "(^#.*#|~|\.sw[op])$">
7371
-        Order allow,deny
7372
-        Deny from all
7373
-    </Files>
7374
-
7375
-    <IfModule headers_module>
7376
-        Header set X-Content-Type-Options nosniff
7377
-        Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate, private"
7378
-        Header set Pragma no-cache
7379
-    </IfModule>
7380
-
7381
-    <Files .htaccess>
7382
-      deny from all
7383
-    </Files>
7384
-
7385
-    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
7386
-    <Directory "/usr/lib/cgi-bin">
7387
-        AllowOverride All
7388
-        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
7389
-        Order allow,deny
7390
-        Allow from all
7391
-        LimitRequestBody 512000
7392
-    </Directory>
7393
-
7394
-    ErrorLog ${APACHE_LOG_DIR}/error.log
7395
-
7396
-    # Possible values include: debug, info, notice, warn, error, crit,
7397
-    # alert, emerg.
7398
-    LogLevel error
7399
-
7400
-    CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
7401
-
7402
-    #   SSL Engine Switch:
7403
-    #   Enable/Disable SSL for this virtual host.
7404
-    SSLEngine on
7405
-
7406
-	SSLCertificateFile    /etc/ssl/certs/mysubsonicdomainname.com.crt
7407
-	SSLCertificateKeyFile /etc/ssl/private/mysubsonicdomainname.com.key
7408
-
7409
-    # Options based on bettercrypto.org
7410
-    SSLProtocol All -SSLv2 -SSLv3
7411
-    SSLHonorCipherOrder On
7412
-    SSLCompression off
7413
-    SSLCipherSuite EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:+CAMELLIA256:+AES256:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!SEED:!ECDSA:CAMELLIA256-SHA:AES256-SHA:CAMELLIA128-SHA:AES128-SHA
7414
-
7415
-    # Add six earth month HSTS header for all users ...
7416
-    Header add Strict-Transport-Security "max-age=15768000"
7417
-    # If you want to protect all subdomains , use the following header
7418
-    # ALL subdomains HAVE TO support https if you use this !
7419
-    # Strict-Transport-Security: max-age=15768000 ; includeSubDomains
7420
-
7421
-    #   SSL Engine Options:
7422
-    #   Set various options for the SSL engine.
7423
-    #   o FakeBasicAuth:
7424
-    #     Translate the client X.509 into a Basic Authorisation.  This means that
7425
-    #     the standard Auth/DBMAuth methods can be used for access control.  The
7426
-    #     user name is the `one line' version of the client's X.509 certificate.
7427
-    #     Note that no password is obtained from the user. Every entry in the user
7428
-    #     file needs this password: `xxj31ZMTZzkVA'.
7429
-    #   o ExportCertData:
7430
-    #     This exports two additional environment variables: SSL_CLIENT_CERT and
7431
-    #     SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
7432
-    #     server (always existing) and the client (only existing when client
7433
-    #     authentication is used). This can be used to import the certificates
7434
-    #     into CGI scripts.
7435
-    #   o StdEnvVars:
7436
-    #     This exports the standard SSL/TLS related `SSL_*' environment variables.
7437
-    #     Per default this exportation is switched off for performance reasons,
7438
-    #     because the extraction step is an expensive operation and is usually
7439
-    #     useless for serving static content. So one usually enables the
7440
-    #     exportation for CGI and SSI requests only.
7441
-    #   o StrictRequire:
7442
-    #     This denies access when "SSLRequireSSL" or "SSLRequire" applied even
7443
-    #     under a "Satisfy any" situation, i.e. when it applies access is denied
7444
-    #     and no other module can change it.
7445
-    #   o OptRenegotiate:
7446
-    #     This enables optimized SSL connection renegotiation handling when SSL
7447
-    #     directives are used in per-directory context.
7448
-    #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
7449
-    <FilesMatch "\.(cgi|shtml|phtml|php)$">
7450
-        SSLOptions +StdEnvVars
7451
-    </FilesMatch>
7452
-    <Directory /usr/lib/cgi-bin>
7453
-        SSLOptions +StdEnvVars
7454
-    </Directory>
7455
-
7456
-    #   SSL Protocol Adjustments:
7457
-    #   The safe and default but still SSL/TLS standard compliant shutdown
7458
-    #   approach is that mod_ssl sends the close notify alert but doesn't wait for
7459
-    #   the close notify alert from client. When you need a different shutdown
7460
-    #   approach you can use one of the following variables:
7461
-    #   o ssl-unclean-shutdown:
7462
-    #     This forces an unclean shutdown when the connection is closed, i.e. no
7463
-    #     SSL close notify alert is send or allowed to received.  This violates
7464
-    #     the SSL/TLS standard but is needed for some brain-dead browsers. Use
7465
-    #     this when you receive I/O errors because of the standard approach where
7466
-    #     mod_ssl sends the close notify alert.
7467
-    #   o ssl-accurate-shutdown:
7468
-    #     This forces an accurate shutdown when the connection is closed, i.e. a
7469
-    #     SSL close notify alert is send and mod_ssl waits for the close notify
7470
-    #     alert of the client. This is 100% SSL/TLS standard compliant, but in
7471
-    #     practice often causes hanging connections with brain-dead browsers. Use
7472
-    #     this only for browsers where you know that their SSL implementation
7473
-    #     works correctly.
7474
-    #   Notice: Most problems of broken clients are also related to the HTTP
7475
-    #   keep-alive facility, so you usually additionally want to disable
7476
-    #   keep-alive for those clients, too. Use variable "nokeepalive" for this.
7477
-    #   Similarly, one has to force some clients to use HTTP/1.0 to workaround
7478
-    #   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
7479
-    #   "force-response-1.0" for this.
7480
-    BrowserMatch "MSIE [2-6]" \
7481
-        nokeepalive ssl-unclean-shutdown \
7482
-        downgrade-1.0 force-response-1.0
7483
-    # MSIE 7 and newer should be able to use keepalive
7484
-    BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
7485
-
7486
-</VirtualHost>
7487
-</IfModule>
7488
-#+END_SRC
7489
-
7490
-Save and exit.
7491
-
7492
-#+BEGIN_SRC: bash
7493
-makecert mysubsonicdomainname.com
7494
-a2ensite mysubsonicdomainname.com
7495
-service apache2 restart
7496
-#+END_SRC
7497 7245
 *** Configuration
7498 7246
 Open a browser and go to your subsonic domain name. Log in with username /admin/ and password /admin/, then change your administrator password.
7499 7247