当启用Pagespeed模块时打开页面速度; 在我的vHost(没有启用pagespeed的工程很好),它给了我这个错误:
ubuntu@ireland:/etc/nginx/sites-available$ sudo service nginx restart Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details. ubuntu@ireland:/etc/nginx/sites-available$ sudo systemctl status nginx.service ● nginx.service - The NGINX HTTP and reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; disabled; vendor preset: enabled) Active: failed (Result: exit-code) since Sat 2016-11-26 12:48:01 UTC; 4s ago Process: 2291 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, status=0/SUCCESS) Process: 2264 ExecStart=/usr/local/nginx/sbin/nginx (code=exited, status=0/SUCCESS) Process: 2401 ExecStartPre=/usr/local/nginx/sbin/nginx -t (code=exited, status=1/FAILURE) Main PID: 2268 (code=exited, status=0/SUCCESS) Nov 26 12:48:01 ireland.srv.tuotteet.org systemd[1]: Starting The NGINX HTTP and reverse proxy server... Nov 26 12:48:01 ireland.srv.tuotteet.org nginx[2401]: nginx: [emerg] "return" directive FileCachePath must be set in /usr/local/nginx/conf/nginx.conf:64 Nov 26 12:48:01 ireland.srv.tuotteet.org nginx[2401]: nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed Nov 26 12:48:01 ireland.srv.tuotteet.org systemd[1]: nginx.service: Control process exited, code=exited status=1 Nov 26 12:48:01 ireland.srv.tuotteet.org systemd[1]: Failed to start The NGINX HTTP and reverse proxy server. Nov 26 12:48:01 ireland.srv.tuotteet.org systemd[1]: nginx.service: Unit entered failed state. Nov 26 12:48:01 ireland.srv.tuotteet.org systemd[1]: nginx.service: Failed with result 'exit-code'. ubuntu@ireland:/etc/nginx/sites-available$
nginx.conf
user www-data; worker_processes auto; pid /run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # SSL Settings ## ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE ssl_prefer_server_ciphers on; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; gzip_disable "msie6"; # gzip_vary on; # gzip_proxied any; # gzip_comp_level 6; # gzip_buffers 16 8k; # gzip_http_version 1.1; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml; ## # Virtual Host Configs ## include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; }
网站可用/ default.conf
server { # SSL configuration # listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; # # Note: You should disable gzip for SSL traffic. # See: https://bugs.debian.org/773332 # # Read up on ssl_ciphers to ensure a secure configuration. # See: https://bugs.debian.org/765782 # include snippets/ssl-default.conf; include snippets/ssl-params.conf; root /var/www/html; # Add index.php to the list if you are using PHP index index.html index.php; pagespeed on; pagespeed RewriteLevel OptimizeForBandwidth; server_name _; include hhvm.conf; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.(hh|php)$ { fastcgi_keep_conn on; #fastcgi_pass unix:/var/run/hhvm/hhvm.sock; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { log_not_found off; access_log off; allow all; } location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ { expires 604800; log_not_found off; } } server { listen 80; listen [::]:80; server_name ireland.srv.tuotteet.org; include hhvm.conf; location / { return 301 https://$server_name$request_uri; } location /.well-known { root /var/www/html; } }