Jul. 21st, 2024
2024年 6月 16日

Post: Nginx Cheatsheet

Nginx Cheatsheet

Published 08:08 Aug 02, 2020.

Created by @ezra. Categorized in #Programming, and tagged as #Cheatsheet.

Source format: Markdown

Table of Content
  • tail -f /var/log/nginx/error.log -- for viewing error logs in nginx

Django setup cheat sheet


user www-data;
worker_processes auto;

pid /run/;
include /etc/nginx/modules-enabled/*.conf;

events {
  worker_connections 768;
  # multi_accept on;

http {

  upstream test_server {
    server unix:/var/www/html/demirantay/run/gunicorn.sock fail_timeout=10s;

  server {
    include  /etc/nginx/mime.types;

    client_max_body_size 4G;

    # access_log /var/www/test/logs/nginx-access.log;
    # error_log /var/www/test/logs/nginx-error.log warn;

    location /static/ {
      autoindex on;
      alias /var/www/html/demirantay/staticfiles/;

    location /media/ {
      autoindex on;
      alias /var/www/html/demirantay/media/;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;

        if (!-f $request_filename) {
          proxy_pass http://test_server;




django static files:

# Static

STATIC_URL = '/static/'
STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")

MEDIA_URL = "/media/"
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
Pinned Message
I'm looking for a SOFTWARE PROJECT DIRECTOR / SOFTWARE R&D DIRECTOR position in a fresh and dynamic company. I would like to gain the right experience and extend my skills while working in great teams and big projects.
Feel free to contact me.
For more information, please view online résumé or download PDF
本人正在寻求任职 软件项目经理 / 软件技术经理 岗位的机会, 希望加⼊某个新鲜⽽充满活⼒的公司。
如有意向请随时 与我联系
更多信息请 查阅在线简历下载 PDF