2016-01-04 33 views
0

我需要一個配置:使用nginx 1.8.0,drupal 7網站工作配置在Ubuntu 14.04上設置SSL?

設立SSL在Ubuntu 14.04與nginx的 1.8.0,的Drupal 7網站。

買了SSL,實現對服務器的所有步驟(複製conctenate文件)和下面的配置適用於: 上等/ nginx的/網站可用/ Drupal的沒有運氣 - 現場沒有找到。

server { 
    listen 80 default_server; 
    listen [::]:80 default_server ipv6only=on; 

    listen 443 ssl; 

    root /var/www/html/drupal; 
    index index.php index.html index.htm; 

    server_name www.MYSITE.com; 
    ssl_certificate /etc/nginx/ssl/public.crt; 
    ssl_certificate_key /etc/nginx/ssl/mykey.key; 

    error_page 404 /404.html; 
    error_page 500 502 503 504 /50x.html; 
    location = /50x.html { 
     root /usr/share/nginx/html; 
    } 

    location = /favicon.ico { 
    log_not_found off; 
    access_log off; 
    } 

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

    location ~ \..*/.*\.php$ { 
    return 403; 
    } 

    location ~ ^/sites/.*/private/ { 
    return 403; 
    } 

    location ~ (^|/)\. { 
    return 403; 
    } 

    location/{ 
    try_files $uri @rewrite; 
    } 

    location @rewrite { 
    rewrite^/index.php; 
    } 

    location ~ \.php$ { 
    fastcgi_split_path_info ^(.+\.php)(/.+)$; 
    include fastcgi_params; 
    fastcgi_param SCRIPT_FILENAME $request_filename; 
    fastcgi_intercept_errors on; 
    fastcgi_pass unix:/var/run/php5-fpm.sock; 
    } 

    location ~ ^/sites/.*/files/styles/ { 
    try_files $uri @rewrite; 
    } 

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { 
    expires max; 
    log_not_found off; 
    } 
} 

我需要解決什麼問題?

回答

0

忘了包括我的解決方案。 我succeded下面設置: 也是我在Drupal的settings.php中設置基本URL爲HTTPS://www.example.com中

server { 
listen 80; 
server_name www.example.com; 
rewrite ^/(.*) https://www.example.com/$1 permanent; 
} 

server { 

listen 443 ssl; 

root /var/www/html/mydrupaldirectory; 
index index.php index.html index.htm; 

server_name www.mysite.com; 
ssl_certificate /etc/ssl/certs/public.crt; 
ssl_certificate_key /etc/ssl/certs/mykey.key; 

error_page 404 /404.html; 
error_page 500 502 503 504 /50x.html; 
location = /50x.html { 
    root /usr/share/nginx/html; 
}