Posts

Showing posts with the label server block

Nginx access denied error

After setting up a new web root directory for my php app, all I see was: Access denied I removed this line in my server block and everything works: fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; Because I set cgi.fix_pathinfo to 0 in /etc/php/7.0/fpm/php.ini so it conflicts with the above setting.

edX-platform - To run the CMS at port 80 along side with the LMS

By default, the CMS of the edX production stack will run at port 18010 which may be blocked by corporate's network. To make it run at port 80 and can be accessible via the url studio.your.domain, you only need to change the nginx server block of the CMS at /edx/app/nginx/sites-available/cms : upstream cms-backend {             server 127.0.0.1:8010 fail_timeout=0;     } server {   # CMS configuration file for nginx, templated by ansible     listen 80 ;   server_name ~^((stage|prod)-)?studio\..*; ... Then, restart the nginx service: $ sudo service nginx restart Cool!

Django & Nginx - 2 projects, 2 domains, 1 machine

Image
Assuming I have 2 Django projects which are running on port 8000 (project1) and port 8080 (project2) in a same machine. I want to make those 2 projects publicly accessible via 2 different domains: my.firstdomain.com --> project1 my.seconddomain.com --> project2 and not via 2 different ports: my.domain.com --> project1 my.domain.com:8080 --> project2 The solution is to create another server block in the nginx for the second project: 1. Edit the nginx config file /etc/nginx/site-available/default : upstream project1 {     server localhost:8000 fail_timeout=0; } upstream project2 {     server localhost:8080 fail_timeout=0; } server {     listen 80;     server_name my.firstdomain.com;     access_log /home/projects/logs/access_prj1.log;     error_log /home/projects/logs/error_prj1.log;     location /site_media/ {         alias ...