Nginx默认为欢迎页面而不是应用程序(Mediagoblin)

时间:2016-05-22 12:04:23

标签: nginx debian

使用Debian 8.4(Jessie),我正在尝试安装mediagoblin。如果这个问题对你们中的一些人来说是个基本问题,我是一个新手,所以道歉。

我已按照指南(http://mediagoblin.readthedocs.io/en/stable/siteadmin/deploying.html)中列出的步骤操作。在看似成功完成所有步骤之后,我启动了应用程序,但我得到了默认的#34;欢迎使用Debian上的nginx!"而不是mediagoblin。

以下是我遵循的步骤(我的网站是mymedia.mynetwork.local):

sudo apt-get install git-core python python-dev python-lxml python-imaging python-virtualenv npm nodejs-legacy automake nginx
sudo apt-get install postgresql postgresql-client python-psycopg2

sudo su - postgres
createuser -A -D mediagoblin
createdb -E UNICODE -O mediagoblin mediagoblin
exit
# returns to original calling user

sudo useradd -c "GNU MediaGoblin system account" -d /var/lib/mediagoblin -m -r -g www-data mediagoblin
sudo groupadd mediagoblin && sudo usermod --append -G mediagoblin mediagoblin
sudo su mediagoblin -s /bin/bash
exit
# returns to original calling user 

sudo mkdir -p /srv/mymedia.mynetwork.local && sudo chown -hR mediagoblin:www-data /srv/mymedia.mynetwork.local
sudo su mediagoblin -s /bin/bash
cd /srv/mymedia.mynetwork.local
git clone git://git.savannah.gnu.org/mediagoblin.git -b stable
cd mediagoblin
git submodule init && git submodule update

git remote set-url origin git://git.savannah.gnu.org/mediagoblin.git
./bootstrap.sh && ./configure && make
mkdir user_dev && chmod 750 user_dev

./bin/easy_install flup==1.0.3.dev-20110405
su
sudo su mediagoblin -s /bin/bash 
cd /srv/mymedia.mynetwork.local/mediagoblin
cp -av mediagoblin.ini mediagoblin_local.ini && cp -av paste.ini paste_local.ini
nano mediagoblin.ini
#   update email address
#   uncomment - sqlengine = postgresql:///mediagoblin
./bin/gmg dbupdate
./lazyserver.sh --server-name=broadcast
# at this time I'm able to connect to mediagoblin

exit
# returns to original calling user

sudo ln -s /srv/mymedia.mynetwork.local/nginx.conf /etc/nginx/sites-enabled/
# at this point also created /srv/mymedia.mynetwork.local/nginx.conf 

sudo systemctl enable nginx

nginx -t
sudo /etc/init.d/nginx restart
cd /srv/mymedia.mynetwork.local/mediagoblin/
su mediagoblin -s /bin/bash
./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543

我创建的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 mymedia.mynetwork.local www.mymedia.mynetwork.local;
 access_log /var/log/nginx/mymedia.mynetwork.access.log;
 error_log /var/log/nginx/mymedia.mynetwork.error.log;

 # MediaGoblin's stock static files: CSS, JS, etc.
 location /mgoblin_static/ {
    alias /srv/mymedia.mynetwork.local/mediagoblin/mediagoblin/static/;
 }

 # Instance specific media:
 location /mgoblin_media/ {
    alias /srv/mymedia.mynetwork.local/mediagoblin/user_dev/media/public/;
 }

 # Theme static files (usually symlinked in)
 location /theme_static/ {
    alias /srv/mymedia.mynetwork.local/mediagoblin/user_dev/theme_static/;
 }

 # Plugin static files (usually symlinked in)
 location /plugin_static/ {
    alias /srv/mymedia.mynetwork.local/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 "";
 }
}
一切似乎都运作良好。当我启动应用程序时:

mediagoblin@shark:/srv/mymedia.mynetwork.local/mediagoblin$ ./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
2016-05-22 07:25:10,978 INFO    [mediagoblin.app] GNU MediaGoblin 0.9.0 main server starting
2016-05-22 07:25:11,012 INFO    [mediagoblin.app] Setting up plugins.
2016-05-22 07:25:11,012 INFO    [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.geolocation
2016-05-22 07:25:11,012 INFO    [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.basic_auth
2016-05-22 07:25:11,013 INFO    [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.processing_info
2016-05-22 07:25:11,013 INFO    [mediagoblin.init.plugins] Importing plugin module: mediagoblin.media_types.image
2016-05-22 07:25:11,050 INFO    [mediagoblin.init.celery] Setting celery configuration from object "mediagoblin.init.celery.dummy_settings_module"
Starting server in PID 2238.

我似乎无法连接到mediagoblin。 /var/log/nginx的nginx错误日志显示没有任何相关性。同样,自定义nginx.conf中的日志文件指令确实导致创建文件,尽管没有移动(0字节)。

我已经运行了几次(关于mediagoblin开发者的说明 - 当前使用python3的说明不起作用,并且必须使用flup 1.0.3.dev-20110405作为最新版本失败),但仍然相同结果所以我必须遗漏一些东西。

如果有人可以提供帮助那就太棒了。

1 个答案:

答案 0 :(得分:0)

好吧,事实证明另一张海报提供了我能够使用的修复:nginx always serves welcome page

似乎我必须应用此命令:

sudo nginx -s reload

希望这有助于其他人。