Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
799 views
in Technique[技术] by (71.8m points)

vue.js - Configuration for Apache to work with Django and Vue using mod_swgi

I am using a VPS server with Virtualmin that currently has a couple WordPress sites hosted. In a new virtual server, I am trying to use Apache to host a Django REST api with Vue frontend app. I am completely stuck trying to make this work.

When I run Django with manage.py it works fine. For the vue section, I completed a run build and copied the directory files to my root, changed permissions to the virtual server user, and believe I have everything set up close to correct based on the loads of research I have done.

Currently, when I try to navigate to the site, the site shows "ERR_CONNECTION_REFUSED". This now occurs on all my existing websites as well since trying to create the .conf apache file for this project.

I am wondering where I might be going wrong and if there are any obvious flaws in my conf script?

<VirtualHost *:80>
    SuexecUserGroup "#1006" "#1005"
    ServerName keepapp.ca
    ServerAlias www.keepapp.ca
    ServerAlias mail.keepapp.ca
    ServerAlias webmail.keepapp.ca
    ServerAlias admin.keepapp.ca
    DocumentRoot /home/keepapp/public_html
    ErrorLog /var/log/virtualmin/keepapp.ca_error_log
    CustomLog /var/log/virtualmin/keepapp.ca_access_log combined
    ScriptAlias /cgi-bin/ /home/keepapp/cgi-bin/
    ScriptAlias /awstats/ /home/keepapp/cgi-bin/
    DirectoryIndex index.html index.htm index.php index.php4 index.php5
    <Directory /home/keepapp/public_html>
      Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
      allow from all
      AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
      Require all granted
      AddType application/x-httpd-php .php
      AddHandler fcgid-script .php
      AddHandler fcgid-script .php7.2
      FCGIWrapper /home/keepapp/fcgi-bin/php7.2.fcgi .php
      FCGIWrapper /home/keepapp/fcgi-bin/php7.2.fcgi .php7.2
    </Directory>
    <Directory /home/keepapp/cgi-bin>
      allow from all
      AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
      Require all granted
    </Directory>
    RewriteEngine on
    RewriteCond %{HTTP_HOST} =webmail.keepapp.ca
    RewriteRule ^(?!/.well-known)(.*) https://keepapp.ca:20000/ [R]
    RewriteCond %{HTTP_HOST} =admin.keepapp.ca
    RewriteRule ^(?!/.well-known)(.*) https://keepapp.ca:10000/ [R]
    RemoveHandler .php
    RemoveHandler .php7.2
    php_admin_value engine Off
    FcgidMaxRequestLen 1073741824
<Files awstats.pl>
AuthName "keepapp.ca statistics"
AuthType Basic
AuthUserFile /home/keepapp/.awstats-htpasswd
require valid-user
</Files>
Alias /dav /home/keepapp/public_html
<Location /dav>
    DAV on
    AuthType Basic
    AuthName "keepapp.ca"
    AuthUserFile /home/keepapp/etc/dav.digest.passwd
    Require valid-user
    ForceType text/plain
    Satisfy All
    RemoveHandler .php
    RemoveHandler .php7.2
    RewriteEngine off
</Location>
</VirtualHost>
<VirtualHost *:8000>

Alias /static /home/keepapp/public_html/Keep/static
<Directory /home/keepapp/public_html/Keep/static>
    Required all granted
</Directory>

Alias /media /home/keepapp/public_html/Keep/media
<Directory /home/keepapp/public_html/Keep/media>
    Required all granted
</Directory>

<Directory /home/keepapp/public_html/Keep/Keep>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

WSGIScriptAlias /api /home/keepapp/public_html/Keep/Keep/wsgi.py
WSGIDaemonProcess keepapp python-path=/home/keepapp/public_html/Keep:/home/keepapp/public_html/Keep/venv/lip/python3.6/site-packages
WSGIProcessGroup keepapp

</VirtualHost>

I would love to get this working and appreciate any advice you can give. Cheers!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...