I managed to configure the nginx.conf file and it looks like this:
root www www;
worker_processes 1;
worker_rlimit_nofile 8192;
events {
worker_connections 8000;
accept_mutex off;
}
error_log logs/error.log;
pid logs/nginx.pid;
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
keepalive_timeout 5;
sendfile on;
tcp_nopush on;
tcp_nodelay off;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_proxied any;
gzip_types text/html text/plain text/xml application/xml application/xml+rss text/css text/javascript application/javascript application/json;
gzip_static on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";
gzip_vary on;
server {
listen 80 default;
server_name _;
root /srv/www/example.com/public_html/src/static;
expires 1M;
location ~* ^.+\.(manifest)$ {
expires -1D;
root /srv/www/example.com/public_html/src/;
access_log /srv/www/example.com/logs/static.logs;
}
location ~* ^.+\.(ico|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
if (-f $request_filename) {
expires max;
root /srv/www/example.come/public_html/src/static;
access_log /srv/www/example.com/logs/static.logs;
}
}
}
}
My questions for the nginx file: 1) I would like to host my application with the domain name: www.example.com, which line of the nginx.conf file should I change?
My nginx.conf file is in the same folder as app.py.
2) When I tried to start nginx by typing /etc/init.d/nginx start, I received the following error message:
Error message:
Starting nginx: [emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: still could not bind()
nginx.
I did not make any configuration for the nginx.conf file found in / etc / nginx. My questions for this part: 3) How to fix the error? 4) How to start nginx automatically?
I tried to launch the Tornado application by typing python app.py. Then I go to http://xxx.xx.xxx.xxx:8888 and my application works correctly.
, ( ), .
:
5) ?
6) ?
.
.