Mobile app version of vmapp.org
Login or Join
YK1175434

: NGinx Downloading instead of Serving I have nginx setup on my ubuntu server as the web server with 3 config files (minus the site configs) All of my sites now download a application/octet-stream

@YK1175434

Posted in: #Cache #Nginx #Ubuntu

I have nginx setup on my ubuntu server as the web server with 3 config files (minus the site configs)

All of my sites now download a application/octet-stream file rather than serving up the pages.

Where am I going wrong, and how can I get it back to serving the pages up?

nginx.conf

user www-data;
worker_processes 8;
pid /run/nginx.pid;
events {
worker_connections 2048;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 10;
types_hash_max_size 2048;
server_tokens off;
fastcgi_read_timeout 3600;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/www/log/access.log;
error_log /var/www/log/error.log;
ignore_invalid_headers on;
client_max_body_size 1024M;
client_body_buffer_size 15m;
client_header_timeout 400;
client_body_timeout 400;
send_timeout 400;
connection_pool_size 256;
client_header_buffer_size 4k;
large_client_header_buffers 4 32k;
request_pool_size 4k;
output_buffers 4 32k;
postpone_output 1460;
open_file_cache max=10000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
map $scheme $fastcgi_https {
default off;
https on;
}
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;

fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=MYAPP:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";

include /etc/nginx/conf.d/*.conf;
include /var/www/site-config/*;
}


conf.d/gzip.conf

gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 9;
gzip_buffers 16 32k;
gzip_min_length 50;
gzip_types
text/css
text/plain
text/javascript
application/javascript
application/json
application/x-javascript
application/xml
application/xml+rss
application/xhtml+xml
application/x-font-ttf
application/x-font-opentype
application/vnd.ms-fontobject
image/svg+xml
image/x-icon
application/rss+xml
application/atom_xml;


conf.d/all-sites.conf

server {
listen 80;
listen 443 ssl;
location ~ /. {
deny all;
}
location = /50x.html {
root /usr/share/nginx/html;
}
location / {
server_tokens off;
client_max_body_size 20m;
client_body_buffer_size 128k;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ [^/].php(/|$) {
set $no_cache "";
if ($request_method !~ ^(GET|HEAD)$) {
set $no_cache "1";
}
if ($no_cache = "1") {
add_header Set-Cookie "_mcnc=1; Max-Age=2; Path=/";
add_header X-Microcachable "0";
}
if ($http_cookie ~* "_mcnc") {
set $no_cache "1";
}
add_header X-Powered-By "Kevin Pirnie";
fastcgi_no_cache $no_cache;
fastcgi_cache_bypass $no_cache;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 60m;
try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
location ~* .(?:manifest|appcache|html?|xml|json)$ {
add_header X-Powered-By "Kevin Pirnie";
expires -1;
}
location ~* .(?:rss|atom)$ {
if ($http_cookie ~* "_mcnc") {
add_header X-Powered-By "Kevin Pirnie";
expires 1h;
gzip on;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
}
location ~* .(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|otf|ttf|eot|svg|woff)$ {
if ($http_cookie ~* "_mcnc") {
add_header X-Powered-By "Kevin Pirnie";
expires 1y;
access_log off;
gzip on;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
}
location ~* .(?:css|js)$ {
if ($http_cookie ~* "_mcnc") {
add_header X-Powered-By "Kevin Pirnie";
expires 1y;
access_log off;
gzip on;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
}
}


/var/www/site-config/sample

server {
server_name thisismysite.com; return 301 thisismysite.com$request_uri; }
server {
root /var/www/httpdocs/thisismysite.com;
index index.php;
server_name thisismysite.com;
}

10% popularity Vote Up Vote Down


Login to follow query

More posts by @YK1175434

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme