我一直试图在整个周末解决这个问题......我已经放弃了谷歌搜索。我发现了类似的问题,但我找到的解决方案都没有解决问题。我对媒体妖精很陌生,而且此前我还没有真正潜入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
来自
的响应 ./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.
当前mediagoblin 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网址应该无需隐式创建dns入口任何地方... orrr如果我仍然做错了什么。
答案 0 :(得分:0)
您可能在/etc/nginx/sites-enabled/
中有一个默认服务器。如果使用mediagoblin.example.org
访问服务器,则服务器配置将匹配。
您声明使用服务器的IP地址,这意味着将使用默认服务器。
您有多种选择:
server_name
指令中,并假装这是您服务器的有效名称。有关详情,请参阅this document。