可能有些專家可以修改我的腳本。我是noob,並試圖設置nginx & drupal在我的本地pc.It工作正常,除了HTTPS重定向,並得到錯誤消息「端口80 443 HTTPS請求等等等等」。nginx&https重定向,網頁主題/圖片/格式不工作!怎麼了?
我發現這個論壇增加了幾行「proxy_pass」編碼(下面)它可能重定向,所以我做了。那工作!但網站主題和格式現在被刪除。我只能看到帶有鏈接和文本的白頁。任何人都可以給我一些亮點嗎?
server {
listen 80;
server_name localhost;
return 301 https://$host$request_uri;
#rewrite^https://$host$request_uri? permanent;
}
server {
listen 443;
server_name localhost;
ssl on;
ssl_certificate /srv/www/sslcerts/cdb.crt;
ssl_certificate_key /srv/www/sslcerts/cdb.key;
error_page 497 https://$host:$server_port$request_uri;
location/{
root /srv/www/cdb;
index index.php;
#try_files $uri $uri/ /index.php;
try_files $uri @rewrite;
##ADDED LATER & theme not working
proxy_pass http://localhost:80;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-Proto https;
}
location ~ ^/sites/.*/files/styles/ {
try_files $uri @rewrite;
}
location ~ \.php$ {
root /srv/www/cdb/;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
#fastcgi_in;tercept_errors on;
fastcgi_param SCRIPT_FILENAME /srv/www/cdb$fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
include fastcgi_params;
}
if ($request_method !~ ^(GET|HEAD|POST)$) {
return 444;
}
if ($http_user_agent ~* LWP::Simple|BBBike|wget|libwww-perl) {
return 403;
}
if ($http_user_agent ~* msnbot|scrapbot|Purebot|Baiduspider|Lipperhey|Mail.Ru) {
return 403;
}
if ($http_referer ~* (babes|forsale|girl|jewelry|love|nudit|organic|poker|porn|sex|teen|viagra|nude|casino))
{
return 403;
}
location /images/ {
valid_referers none blocked www.example.com example.com;
if ($invalid_referer) {
return 403;
}
}
location @rewrite {
rewrite^/index.php;
}
#location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
# expires max;
# log_not_found off;
# }
location ~* /(images|cache|media|logs|tmp)/.*.(php|pl|py|jsp|asp|sh|cgi)$ {
return 403;
error_page 403 /403_error.html;
}
location ~ /\. {
access_log off;
log_not_found off;
deny all;
}
}
是的,我做到了,仍然沒有工作......用乾淨的URL太.. – user3013501