Skip to content

Instantly share code, notes, and snippets.

@serverok
Created March 8, 2018 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save serverok/9c0680bb5011aceb825e1a7c44efeee4 to your computer and use it in GitHub Desktop.
Save serverok/9c0680bb5011aceb825e1a7c44efeee4 to your computer and use it in GitHub Desktop.
Here is the original config
[root@media web]# cat media1.wankbus.com.nginx.conf
server {
listen 158.69.240.98:80;
server_name media1.wankbus.com ;
error_log /var/log/httpd/domains/media1.wankbus.com.error.log error;
location / {
proxy_pass http://158.69.240.98:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/media1.wankbus.com/public_html;
access_log /var/log/httpd/domains/media1.wankbus.com.log combined;
access_log /var/log/httpd/domains/media1.wankbus.com.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/media1.wankbus.com/document_errors/;
}
location @fallback {
proxy_pass http://158.69.240.98:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.media1.wankbus.com.conf*;
}
[root@media web]#
To fix
find
error_log /var/log/httpd/domains/media1.wankbus.com.error.log error;
Add Below
root /home/admin/web/media1.wankbus.com/public_html;
Here is the final nginx config
[root@media web]# cat media1.wankbus.com.nginx.conf
server {
listen 158.69.240.98:80;
server_name media1.wankbus.com ;
error_log /var/log/httpd/domains/media1.wankbus.com.error.log error;
root /home/admin/web/media1.wankbus.com/public_html;
location / {
proxy_pass http://158.69.240.98:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/media1.wankbus.com/public_html;
access_log /var/log/httpd/domains/media1.wankbus.com.log combined;
access_log /var/log/httpd/domains/media1.wankbus.com.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/media1.wankbus.com/document_errors/;
}
location @fallback {
proxy_pass http://158.69.240.98:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.media1.wankbus.com.conf*;
}
[root@media web]#
Now restart nginx.
service nginx restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment