Deploying django under a sub-URL with Nginx/Fastcgi -
I can not understand how the DJJenja site can be used as a non-root location for NGN / Fastcassi, e.g. Instead ; All the examples that I have seen are either Apache or grow in the root of the site. Here is the relevant part of my nginx.conf
:
server {8080; Server_name localhost; Location / myproject / {fastcgi_pass 127.0.0.13030 with fastcgi server to host and port; Fastcgi_param QUERY_STRING $ query_string; Fastcgi_param REQUEST_METHOD $ request_method; Fastcgi_param CONTENT_TYPE $ content_type; Fastcgi_param CONTENT_LENGTH $ content_length; #fastcgi_param SCRIPT_NAME $ fastcgi_script_name; Fastcase_param pathhinfoofro $ fastcgi_script_name; Fastcgi_param REQUEST_URI $ request_uri; Fastcgi_param DOCUMENT_URI $ document_uri; Fastcgi_param DOCUMENT_ROOT $ document_root; Fastcgi_param SERVER_PROTOCOL $ server_protocol; Fastcgi_param GATEWAY_INTERFACE CGI / 1.1; Fastcgi_param SERVER_SOFTWARE nginx / $ nginx_version; Fastcgi_param REMOTE_ADDR $ remote_addr; Fastcgi_param REMOTE_PORT $ remote_port; Fastcgi_param SERVER_ADDR $ server_addr; Fastcgi_param SERVER_PORT $ server_port; Fastcgi_param SERVER_NAME $ server_name; }}
and at least urls.py
:
)
Gives a 404 in trying to access. I have tried all of their failed combinations:
-
Comment / Ascending
fastcgi_param PATH_INFO $ fastcgi_script_name;
- Comment /
fastcgi_param SCRIPT_NAME $ fastcgi_script_name;
- -text "itemprop =" text ">
pushed itself with the same problem - it has been found that the link given to serverfault was the key to solving the problem.
Dagen> 1.0 used by
SCRIPT_NAME
andPATH_INFO
as the root URL, as explained by the doctor, so I took it and took part with it. For a project called 'Myproject', which you want to submit to mydomain.com/myproject/, try itspace ~ /myproject/(.*)$ {fastcgi_pass 127.0. 0.1: 8080; FastCase_PalmHandEffo / $ 1; SCRIPT_NAME / myproject; } I have a site-wide config file. So your example looks like something
server {8080; Server_name localhost; Location / myproject / {fastcgi_pass 127.0.0.13030 with fastcgi server to host and port; Fastcgi_param QUERY_STRING $ query_string; Fastcgi_param REQUEST_METHOD $ request_method; Fastcgi_param CONTENT_TYPE $ content_type; Fastcgi_param CONTENT_LENGTH $ content_length; Fastcgi_param SCRIPT_NAME / myproject; FastCase_PalmHandEffo / $ 1; Fastcgi_param REQUEST_URI $ request_uri; Fastcgi_param DOCUMENT_URI $ document_uri; Fastcgi_param DOCUMENT_ROOT $ document_root; Fastcgi_param SERVER_PROTOCOL $ server_protocol; Fastcgi_param GATEWAY_INTERFACE CGI / 1.1; Fastcgi_param SERVER_SOFTWARE nginx / $ nginx_version; Fastcgi_param REMOTE_ADDR $ remote_addr; Fastcgi_param REMOTE_PORT $ remote_port; Fastcgi_param SERVER_ADDR $ server_addr; Fastcgi_param SERVER_PORT $ server_port; Fastcgi_param SERVER_NAME $ server_name; }}
with the same urls.py I have just put small problems in keeping such issues in mind, as if settings.py need a complete url and do not think of starting DJ code on
SCRIPT_NAME
(Settings .LOGIN_URL
,settings.MEDIA_URL
).This may be obvious, but also make sure that you have another place that indicates your constant and admin media.
Comments
Post a Comment