server { listen 80; listen [::]:80; server_name portalha.impa.br; return 301 https://$host$request_uri; } server { set $host_path "/var/www/virtualhosts/portal-da-matematica"; access_log /var/log/nginx/portalha.impa.br-access.log; error_log /var/log/nginx/portalha.impa.br-error.log; listen 443; listen [::]:443; server_name portalha.impa.br; root $host_path; set $yii_bootstrap "index.php"; charset utf-8; rewrite ^/$ /index.php redirect; ssl on; ssl_certificate /etc/ssl/certs/impa/bundle.crt; ssl_certificate_key /etc/ssl/certs/impa/impa.key; location / { index index.html $yii_bootstrap; try_files $uri $uri/ /$yii_bootstrap?$args; } #location ~* \.(eot|ttf|woff|woff2)$ { # add_header Access-Control-Allow-Origin *; #} location ~ ^/(protected|framework|themes/\w+/views) { deny all; } #avoid processing of calls to unexisting static files by yii location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { try_files $uri =404; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php { fastcgi_split_path_info ^(.+\.php)(.*)$; #let yii catch the calls to unexising PHP files set $fsn /$yii_bootstrap; if (-f $document_root$fastcgi_script_name){ set $fsn $fastcgi_script_name; } fastcgi_param APPLICATION_ENV test; fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; #fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fsn; #PATH_INFO and PATH_TRANSLATED can be omitted, but RFC 3875 specifies them for CGI fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fsn; } # prevent nginx from serving dotfiles (.htaccess, .svn, .git, etc.) location ~ /\. { deny all; access_log off; log_not_found off; } }