Как настроить кеширование на apache+nginx?

Добрый времени суток такой вопрос.
У меня на vps стоит apache + nginx
Мне необходимо кэшировать данные, прочитал статьи
docs.moodle.org/archive/ru/%D0%9D%D0%B0%D1...

#! Статический контент! location ~* \.(jpg|jpeg|gif|png|swf|tiff|swf|flv)$ { root $webroot; #Кеширум картинки месяца на 4 expires 4M; #Кешируем везде (и на прокси и на клиентах) add_header Cache-Control public; }
в примере осуществляется кеширование на стороне как клиента так и промежуточных серверов. переменная $webroot указывает, где находиться папка с файлами moodle, например:
set $webroot '/var/www/moodle'; root $webroot;
этого момента я не до конца не догоняю, куда он ссылаться должен??

весь файл
user apache; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; server_tokens off; client_max_body_size 100m; log_format main '$remote_addr — $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; ############################################################ #GZIP gzip on; gzip_min_length 1000; gzip_proxied expired no-cache no-store private auth; gzip_types text/plain application/xml; # Выделяем буфер для gzip gzip_buffers 32 4k; # Устанавливаем уровень сжатия, от 1-9 gzip_comp_level 9; # Убираем поддержку IE6 gzip_disable «msie6»; # Устанавливаем версию для использования gzip (1.0 или 1.1) gzip_http_version 1.1; # Разрешаем использовать статику gzip_static on; gzip_vary on; gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml application/rss+xml font/truetype application/x-font-ttf font/opentype applicatio$ ############################################################ ### #GZIP server_names_hash_bucket_size 128; server_names_hash_max_size 1024; ssl_session_cache shared:SSL:10m; ssl_session_timeout 5m; ssl_prefer_server_ciphers on; ssl_stapling on; ssl_stapling_verify on; ssl_trusted_certificate "/etc/pki/tls/certs/ca-certs.pem"; resolver 8.8.8.8 8.8.4.4 valid=300s; resolver_timeout 5s; include /etc/nginx/conf.d/*.conf; # include /etc/nginx/vhosts/*.conf; server { server_name 127.0.0.1; disable_symlinks if_not_owner; listen 80; include /etc/nginx/vhosts-includes/*.conf; location @fallback { proxy_read_timeout 900; #client_header_timeout 10m; client_body_timeout 10m; send_timeout 10m; error_log /dev/null crit; proxy_pass 127.0.0.1:8080; proxy_redirect 127.0.0.1:8080 /; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Secret L8uHXMXyTQiO3Q83; access_log off; } #return 301 https://$host$request_uri; } }

UPD
nginx.service — nginx — high performance web server Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled) Active: failed (Result: exit-code) since Wed 2016-02-03 02:13:43 EST; 2s ago Docs: nginx.org/en/docs/ Process: 4661 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, status=0/SUCCESS) Process: 4570 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS) Process: 4665 ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE) Main PID: 4573 (code=exited, status=0/SUCCESS) Feb 03 02:13:43 ip-172-31-17-236.us-west-2.compute.internal systemd[1]: Starting nginx — high performance web server… Feb 03 02:13:43 ip-172-31-17-236.us-west-2.compute.internal nginx[4665]: nginx: [warn] duplicate MIME type «text/plain» in /etc/nginx/nginx.conf:54 Feb 03 02:13:43 ip-172-31-17-236.us-west-2.compute.internal nginx[4665]: nginx: [warn] duplicate MIME type «application/xml» in /etc/nginx/nginx.conf:54 Feb 03 02:13:43 ip-172-31-17-236.us-west-2.compute.internal nginx[4665]: nginx: [emerg] «location» directive is not allowed here in /etc/nginx/nginx.conf:103 Feb 03 02:13:43 ip-172-31-17-236.us-west-2.compute.internal nginx[4665]: nginx: configuration file /etc/nginx/nginx.conf test failed Feb 03 02:13:43 ip-172-31-17-236.us-west-2.compute.internal systemd[1]: nginx.service: control process exited, code=exited status=1 Feb 03 02:13:43 ip-172-31-17-236.us-west-2.compute.internal systemd[1]: Failed to start nginx — high performance web server. Feb 03 02:13:43 ip-172-31-17-236.us-west-2.compute.internal systemd[1]: Unit nginx.service entered failed state.
— Logs begin at Thu 2015-07-23 08:45:50 EDT, end at Wed 2016-02-03 02:14:42 EST. — Feb 03 02:14:39 ip-172-31-17-236.us-west-2.compute.internal sshd[4684]: Failed password for invalid user admin from 185.124.85.162 port 40611 ssh2 Feb 03 02:14:39 ip-172-31-17-236.us-west-2.compute.internal sshd[4684]: Disconnecting: Too many authentication failures for admin [preauth] Feb 03 02:14:39 ip-172-31-17-236.us-west-2.compute.internal sshd[4684]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=185.124.85.162 Feb 03 02:14:40 ip-172-31-17-236.us-west-2.compute.internal sshd[4688]: reverse mapping checking getaddrinfo for server2.dizaynwebtasarim.com [185.124.85.162] failed — POSSIBLE BREAK-IN ATTEMPT! Feb 03 02:14:40 ip-172-31-17-236.us-west-2.compute.internal sshd[4688]: Invalid user admin from 185.124.85.162 Feb 03 02:14:40 ip-172-31-17-236.us-west-2.compute.internal sshd[4688]: input_userauth_request: invalid user admin [preauth] Feb 03 02:14:41 ip-172-31-17-236.us-west-2.compute.internal sshd[4688]: pam_unix(sshd:auth): check pass; user unknown Feb 03 02:14:41 ip-172-31-17-236.us-west-2.compute.internal sshd[4688]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=185.124.85.162 Feb 03 02:14:41 ip-172-31-17-236.us-west-2.compute.internal sshd[4686]: Failed password for root from 59.45.79.116 port 31114 ssh2 Feb 03 02:14:42 ip-172-31-17-236.us-west-2.compute.internal sshd[4686]: pam_succeed_if(sshd:auth): requirement «uid >= 1000» not met by user «root»