nginx 不在 debian jessie 上提供默认的 mediagoblin
nginx not serving default mediagoblin on debian jessie
我整个周末都在努力解决这个问题……我已经放弃了谷歌搜索。我发现了类似的问题,但是 none 我找到的解决方案已经解决了这个问题。我对 media goblin 很陌生,之前还没有真正深入 linux 这么深,所以我很菜鸟。
我已按照 http://mediagoblin.readthedocs.io/en/stable/siteadmin/deploying.html 的说明进行操作,保留所有默认设置,只是为了让默认设置正常工作。我想从那里我可以开始改变事情,看看会发生什么。好的介绍。
当我输入
nginx -t
我明白了
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
当我输入
./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543
我明白了
Using paster config: paste_local.ini
Using ./bin/paster
+ export CELERY_ALWAYS_EAGER=true
+ ./bin/paster serve paste_local.ini --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543 --reload
Starting subprocess with file monitor
2017-05-22 08:39:22,377 INFO [mediagoblin.app] GNU MediaGoblin 0.9.0 main server starting
2017-05-22 08:39:22,647 INFO [mediagoblin.app] Setting up plugins.
2017-05-22 08:39:22,648 INFO [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.geolocation
2017-05-22 08:39:22,648 INFO [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.basic_auth
2017-05-22 08:39:22,648 INFO [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.processing_info
2017-05-22 08:39:22,648 INFO [mediagoblin.init.plugins] Importing plugin module: mediagoblin.media_types.image
2017-05-22 08:39:22,797 INFO [mediagoblin.init.celery] Setting celery configuration from object "mediagoblin.init.celery.dummy_settings_module"
Starting server in PID 990.
服务器似乎没有被提供服务。当我转到服务器 ip 时,我得到默认的 nginx 页面。
我的/etc/nginx/nginx.conf文件如下
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
我的/etc/nginx/sites-enabled/nginx.conf如下
server {
#################################################
# Stock useful config options, but ignore them :)
#################################################
include /etc/nginx/mime.types;
autoindex off;
default_type application/octet-stream;
sendfile on;
# Gzip
gzip on;
gzip_min_length 1024;
gzip_buffers 4 32k;
gzip_types text/plain application/x-javascript text/javascript text/xml text/css;
#####################################
# Mounting MediaGoblin stuff
# This is the section you should read
#####################################
# Change this to update the upload size limit for your users
client_max_body_size 8m;
# prevent attacks (someone uploading a .txt file that the browser
# interprets as an HTML file, etc.)
add_header X-Content-Type-Options nosniff;
server_name mediagoblin.example.org www.mediagoblin.example.org;
access_log /var/log/nginx/mediagoblin.example.access.log;
error_log /var/log/nginx/mediagoblin.example.error.log;
# MediaGoblin's stock static files: CSS, JS, etc.
location /mgoblin_static/ {
alias /srv/mediagoblin.example.org/mediagoblin/mediagoblin/static/;
}
# Instance specific media:
location /mgoblin_media/ {
alias /srv/mediagoblin.example.org/mediagoblin/user_dev/media/public/;
}
# Theme static files (usually symlinked in)
location /theme_static/ {
alias /srv/mediagoblin.example.org/mediagoblin/user_dev/theme_static/;
}
# Plugin static files (usually symlinked in)
location /plugin_static/ {
alias /srv/mediagoblin.example.org/mediagoblin/user_dev/plugin_static/;
}
# Mounting MediaGoblin itself via FastCGI.
location / {
fastcgi_pass 127.0.0.1:26543;
include /etc/nginx/fastcgi_params;
# our understanding vs nginx's handling of script_name vs
# path_info don't match :)
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SCRIPT_NAME "";
}
}
如有任何建议,我们将不胜感激。
编辑 1
来自 运行ning 的回应
./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543
还是
Using paster config: paste_local.ini
Using ./bin/paster
+ export CELERY_ALWAYS_EAGER=true
+ ./bin/paster serve paste_local.ini --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543 --reload
Starting subprocess with file monitor
2017-05-22 12:06:37,345 INFO [mediagoblin.app] GNU MediaGoblin 0.9.0 main server starting
2017-05-22 12:06:37,583 INFO [mediagoblin.app] Setting up plugins.
2017-05-22 12:06:37,584 INFO [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.geolocation
2017-05-22 12:06:37,584 INFO [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.basic_auth
2017-05-22 12:06:37,584 INFO [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.processing_info
2017-05-22 12:06:37,585 INFO [mediagoblin.init.plugins] Importing plugin module: mediagoblin.media_types.image
2017-05-22 12:06:37,714 INFO [mediagoblin.init.celery] Setting celery configuration from object "mediagoblin.init.celery.dummy_settings_module"
Starting server in PID 976.
当前媒体妖精nginx.conf:
server {
#################################################
# Stock useful config options, but ignore them :)
#################################################
include /etc/nginx/mime.types;
autoindex off;
default_type application/octet-stream;
sendfile on;
# Gzip
gzip on;
gzip_min_length 1024;
gzip_buffers 4 32k;
gzip_types text/plain application/x-javascript text/javascript text/xml text/css;
listen 80;
server_name 10.1.1.74;
#####################################
# Mounting MediaGoblin stuff
# This is the section you should read
#####################################
# Change this to update the upload size limit for your users
client_max_body_size 8m;
# prevent attacks (someone uploading a .txt file that the browser
# interprets as an HTML file, etc.)
add_header X-Content-Type-Options nosniff;
server_name mediagoblin.example.org www.mediagoblin.example.org;
access_log /var/log/nginx/mediagoblin.example.access.log;
error_log /var/log/nginx/mediagoblin.example.error.log;
# MediaGoblin's stock static files: CSS, JS, etc.
location /mgoblin_static/ {
alias /srv/mediagoblin.example.org/mediagoblin/mediagoblin/static/;
}
# Instance specific media:
location /mgoblin_media/ {
alias /srv/mediagoblin.example.org/mediagoblin/user_dev/media/public/;
}
# Theme static files (usually symlinked in)
location /theme_static/ {
alias /srv/mediagoblin.example.org/mediagoblin/user_dev/theme_static/;
}
# Plugin static files (usually symlinked in)
location /plugin_static/ {
alias /srv/mediagoblin.example.org/mediagoblin/user_dev/plugin_static/;
}
# Mounting MediaGoblin itself via FastCGI.
location / {
fastcgi_pass 127.0.0.1:26543;
include /etc/nginx/fastcgi_params;
# our understanding vs nginx's handling of script_name vs
# path_info don't match :)
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SCRIPT_NAME "";
}
}
当前 /etc/nginx/nginx.conf:
编辑 2
服务器的当前 nginx.conf 文件(两个默认值都有效)
server {
#################################################
# Stock useful config options, but ignore them :)
#################################################
include /etc/nginx/mime.types;
autoindex off;
default_type application/octet-stream;
sendfile on;
# Gzip
gzip on;
gzip_min_length 1024;
gzip_buffers 4 32k;
gzip_types text/plain application/x-javascript text/javascript text/xml text/css;
listen 80;
server_name 10.0.0.192;
#####################################
# Mounting MediaGoblin stuff
# This is the section you should read
#####################################
# Change this to update the upload size limit for your users
client_max_body_size 8m;
# prevent attacks (someone uploading a .txt file that the browser
# interprets as an HTML file, etc.)
add_header X-Content-Type-Options nosniff;
server_name mediagoblin.example.org www.mediagoblin.example.org;
access_log /var/log/nginx/mediagoblin.example.access.log;
error_log /var/log/nginx/mediagoblin.example.error.log;
# MediaGoblin's stock static files: CSS, JS, etc.
location /mgoblin_static/ {
alias /srv/mediagoblin.example.org/mediagoblin/mediagoblin/static/;
}
# Instance specific media:
location /mgoblin_media/ {
alias /srv/mediagoblin.example.org/mediagoblin/user_dev/media/public/;
}
# Theme static files (usually symlinked in)
location /theme_static/ {
alias /srv/mediagoblin.example.org/mediagoblin/user_dev/theme_static/;
}
# Plugin static files (usually symlinked in)
location /plugin_static/ {
alias /srv/mediagoblin.example.org/mediagoblin/user_dev/plugin_static/;
}
# Mounting MediaGoblin itself via FastCGI.
location / {
fastcgi_pass 10.0.0.192:26543;
include /etc/nginx/fastcgi_params;
# our understanding vs nginx's handling of script_name vs
# path_info don't match :)
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SCRIPT_NAME "";
}
}
当我按照指南的建议运行这个命令时,我无法加载页面。
./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543
然而当我运行这个命令时,它起作用了。
./lazyserver.sh --server-name=fcgi fcgi_host=10.0.0.192 fcgi_port=26543
我不确定指南补充的第一个是否暗示您正在本地访问它...这是有道理的,因为在说明中创建的 dns url 应该是工作时无需隐式地在任何地方创建 dns 条目...如果我仍然做错了,或者。
您可能在 /etc/nginx/sites-enabled/
中有一个默认服务器。如果您使用 mediagoblin.example.org
访问服务器,那么您的服务器配置将匹配。
您声明您使用服务器的 IP 地址,这意味着将使用默认服务器。
您有多种选择:
- 您可以将 IP 地址添加到
server_name
指令并假装这是您的服务器的有效名称。
- 您可以设置 DNS 或主机,以便使用正确的名称。
- 您可以删除其他配置文件,使该配置成为事实上的默认服务器。
有关更多信息,请参阅 this document。
我整个周末都在努力解决这个问题……我已经放弃了谷歌搜索。我发现了类似的问题,但是 none 我找到的解决方案已经解决了这个问题。我对 media goblin 很陌生,之前还没有真正深入 linux 这么深,所以我很菜鸟。
我已按照 http://mediagoblin.readthedocs.io/en/stable/siteadmin/deploying.html 的说明进行操作,保留所有默认设置,只是为了让默认设置正常工作。我想从那里我可以开始改变事情,看看会发生什么。好的介绍。
当我输入
nginx -t
我明白了
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
当我输入
./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543
我明白了
Using paster config: paste_local.ini
Using ./bin/paster
+ export CELERY_ALWAYS_EAGER=true
+ ./bin/paster serve paste_local.ini --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543 --reload
Starting subprocess with file monitor
2017-05-22 08:39:22,377 INFO [mediagoblin.app] GNU MediaGoblin 0.9.0 main server starting
2017-05-22 08:39:22,647 INFO [mediagoblin.app] Setting up plugins.
2017-05-22 08:39:22,648 INFO [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.geolocation
2017-05-22 08:39:22,648 INFO [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.basic_auth
2017-05-22 08:39:22,648 INFO [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.processing_info
2017-05-22 08:39:22,648 INFO [mediagoblin.init.plugins] Importing plugin module: mediagoblin.media_types.image
2017-05-22 08:39:22,797 INFO [mediagoblin.init.celery] Setting celery configuration from object "mediagoblin.init.celery.dummy_settings_module"
Starting server in PID 990.
服务器似乎没有被提供服务。当我转到服务器 ip 时,我得到默认的 nginx 页面。
我的/etc/nginx/nginx.conf文件如下
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
我的/etc/nginx/sites-enabled/nginx.conf如下
server {
#################################################
# Stock useful config options, but ignore them :)
#################################################
include /etc/nginx/mime.types;
autoindex off;
default_type application/octet-stream;
sendfile on;
# Gzip
gzip on;
gzip_min_length 1024;
gzip_buffers 4 32k;
gzip_types text/plain application/x-javascript text/javascript text/xml text/css;
#####################################
# Mounting MediaGoblin stuff
# This is the section you should read
#####################################
# Change this to update the upload size limit for your users
client_max_body_size 8m;
# prevent attacks (someone uploading a .txt file that the browser
# interprets as an HTML file, etc.)
add_header X-Content-Type-Options nosniff;
server_name mediagoblin.example.org www.mediagoblin.example.org;
access_log /var/log/nginx/mediagoblin.example.access.log;
error_log /var/log/nginx/mediagoblin.example.error.log;
# MediaGoblin's stock static files: CSS, JS, etc.
location /mgoblin_static/ {
alias /srv/mediagoblin.example.org/mediagoblin/mediagoblin/static/;
}
# Instance specific media:
location /mgoblin_media/ {
alias /srv/mediagoblin.example.org/mediagoblin/user_dev/media/public/;
}
# Theme static files (usually symlinked in)
location /theme_static/ {
alias /srv/mediagoblin.example.org/mediagoblin/user_dev/theme_static/;
}
# Plugin static files (usually symlinked in)
location /plugin_static/ {
alias /srv/mediagoblin.example.org/mediagoblin/user_dev/plugin_static/;
}
# Mounting MediaGoblin itself via FastCGI.
location / {
fastcgi_pass 127.0.0.1:26543;
include /etc/nginx/fastcgi_params;
# our understanding vs nginx's handling of script_name vs
# path_info don't match :)
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SCRIPT_NAME "";
}
}
如有任何建议,我们将不胜感激。
编辑 1
来自 运行ning 的回应
./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543
还是
Using paster config: paste_local.ini
Using ./bin/paster
+ export CELERY_ALWAYS_EAGER=true
+ ./bin/paster serve paste_local.ini --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543 --reload
Starting subprocess with file monitor
2017-05-22 12:06:37,345 INFO [mediagoblin.app] GNU MediaGoblin 0.9.0 main server starting
2017-05-22 12:06:37,583 INFO [mediagoblin.app] Setting up plugins.
2017-05-22 12:06:37,584 INFO [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.geolocation
2017-05-22 12:06:37,584 INFO [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.basic_auth
2017-05-22 12:06:37,584 INFO [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.processing_info
2017-05-22 12:06:37,585 INFO [mediagoblin.init.plugins] Importing plugin module: mediagoblin.media_types.image
2017-05-22 12:06:37,714 INFO [mediagoblin.init.celery] Setting celery configuration from object "mediagoblin.init.celery.dummy_settings_module"
Starting server in PID 976.
当前媒体妖精nginx.conf:
server {
#################################################
# Stock useful config options, but ignore them :)
#################################################
include /etc/nginx/mime.types;
autoindex off;
default_type application/octet-stream;
sendfile on;
# Gzip
gzip on;
gzip_min_length 1024;
gzip_buffers 4 32k;
gzip_types text/plain application/x-javascript text/javascript text/xml text/css;
listen 80;
server_name 10.1.1.74;
#####################################
# Mounting MediaGoblin stuff
# This is the section you should read
#####################################
# Change this to update the upload size limit for your users
client_max_body_size 8m;
# prevent attacks (someone uploading a .txt file that the browser
# interprets as an HTML file, etc.)
add_header X-Content-Type-Options nosniff;
server_name mediagoblin.example.org www.mediagoblin.example.org;
access_log /var/log/nginx/mediagoblin.example.access.log;
error_log /var/log/nginx/mediagoblin.example.error.log;
# MediaGoblin's stock static files: CSS, JS, etc.
location /mgoblin_static/ {
alias /srv/mediagoblin.example.org/mediagoblin/mediagoblin/static/;
}
# Instance specific media:
location /mgoblin_media/ {
alias /srv/mediagoblin.example.org/mediagoblin/user_dev/media/public/;
}
# Theme static files (usually symlinked in)
location /theme_static/ {
alias /srv/mediagoblin.example.org/mediagoblin/user_dev/theme_static/;
}
# Plugin static files (usually symlinked in)
location /plugin_static/ {
alias /srv/mediagoblin.example.org/mediagoblin/user_dev/plugin_static/;
}
# Mounting MediaGoblin itself via FastCGI.
location / {
fastcgi_pass 127.0.0.1:26543;
include /etc/nginx/fastcgi_params;
# our understanding vs nginx's handling of script_name vs
# path_info don't match :)
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SCRIPT_NAME "";
}
}
当前 /etc/nginx/nginx.conf:
编辑 2 服务器的当前 nginx.conf 文件(两个默认值都有效)
server {
#################################################
# Stock useful config options, but ignore them :)
#################################################
include /etc/nginx/mime.types;
autoindex off;
default_type application/octet-stream;
sendfile on;
# Gzip
gzip on;
gzip_min_length 1024;
gzip_buffers 4 32k;
gzip_types text/plain application/x-javascript text/javascript text/xml text/css;
listen 80;
server_name 10.0.0.192;
#####################################
# Mounting MediaGoblin stuff
# This is the section you should read
#####################################
# Change this to update the upload size limit for your users
client_max_body_size 8m;
# prevent attacks (someone uploading a .txt file that the browser
# interprets as an HTML file, etc.)
add_header X-Content-Type-Options nosniff;
server_name mediagoblin.example.org www.mediagoblin.example.org;
access_log /var/log/nginx/mediagoblin.example.access.log;
error_log /var/log/nginx/mediagoblin.example.error.log;
# MediaGoblin's stock static files: CSS, JS, etc.
location /mgoblin_static/ {
alias /srv/mediagoblin.example.org/mediagoblin/mediagoblin/static/;
}
# Instance specific media:
location /mgoblin_media/ {
alias /srv/mediagoblin.example.org/mediagoblin/user_dev/media/public/;
}
# Theme static files (usually symlinked in)
location /theme_static/ {
alias /srv/mediagoblin.example.org/mediagoblin/user_dev/theme_static/;
}
# Plugin static files (usually symlinked in)
location /plugin_static/ {
alias /srv/mediagoblin.example.org/mediagoblin/user_dev/plugin_static/;
}
# Mounting MediaGoblin itself via FastCGI.
location / {
fastcgi_pass 10.0.0.192:26543;
include /etc/nginx/fastcgi_params;
# our understanding vs nginx's handling of script_name vs
# path_info don't match :)
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SCRIPT_NAME "";
}
}
当我按照指南的建议运行这个命令时,我无法加载页面。
./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543
然而当我运行这个命令时,它起作用了。
./lazyserver.sh --server-name=fcgi fcgi_host=10.0.0.192 fcgi_port=26543
我不确定指南补充的第一个是否暗示您正在本地访问它...这是有道理的,因为在说明中创建的 dns url 应该是工作时无需隐式地在任何地方创建 dns 条目...如果我仍然做错了,或者。
您可能在 /etc/nginx/sites-enabled/
中有一个默认服务器。如果您使用 mediagoblin.example.org
访问服务器,那么您的服务器配置将匹配。
您声明您使用服务器的 IP 地址,这意味着将使用默认服务器。
您有多种选择:
- 您可以将 IP 地址添加到
server_name
指令并假装这是您的服务器的有效名称。 - 您可以设置 DNS 或主机,以便使用正确的名称。
- 您可以删除其他配置文件,使该配置成为事实上的默认服务器。
有关更多信息,请参阅 this document。