简体   繁体   中英

Can't Deploy Mezzanine CMS using Apache/Ubuntu

I'm trying to become better with deploying a website from scratch so I setup a new Nanode from Linode using the latest Ubuntu (19.04 I think).

I followed the instructions to install Mezzanine CMS (Django Based) and it all went fine, I was able to run the dev server to test the website fine on port 8000.

I did install UFW and right now only activity on port 80 is not rejected. Also I have mysql database running with Mezzanine not Djangos default SQLlite.

I installed Apache and WSGI. At first Apache would not restart due to some configuration issue which I think I've since worked out.

I have a domain alexmerced which is on godaddy, but I have a DNS "a" records which is pointing to my linodes IP address "mezz.alexmerced.com"

Mezzanine is still a fresh install so I haven't really changed anything outside of the WSGI and settings.py.

I currently get a forbidden error when I type the URL or IP address, the permissions of the application directory is 755.

below are my configuration file settings to see if I made any mistakes.

django_project.conf (the only conf file enabled in the /sites-available/ directory

<VirtualHost *:80>
    ServerName mezz.alexmerced.com
    ServerAdmin mezzanine@localhost
    DocumentRoot /mymezz
    WSGIScriptAlias / /mymezz/mymezz/wsgi.py
    Alias /static /mymezz/static/

    <Directory /mymezz/>
    <Files wsgi.py>
        Require all granted
    </Files>
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

here is the wsgi.py file

"""
WSGI config for mymezz project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application
from mezzanine.utils.conf import real_project_name

os.environ.setdefault("DJANGO_SETTINGS_MODULE",
                  "%s.settings" % real_project_name("mymezz"))

application = get_wsgi_application()

other stuff I read on asked me to add the following to my settings.py

PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(PROJECT_ROOT, ".."))
settings_module = "%s.settings" % PROJECT_ROOT.split(os.sep)[-1]
os.environ["DJANGO_SETTINGS_MODULE"] = settings_module

and

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

我从来没有用 Apache 解决过这个问题,但我确实使用 Nginx 和 Uwsgi 成功部署了这个博客,只要小心你的虚拟环境完成后的路径我意识到这就是我使用 apache 的问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM