he seguidoesteguía yestepara implementar mi django con guniconrn y apache.
Pero no entiendo muy bien quéesteguía dice:
(Aún necesita especificar Alias y para los archivos estáticos y multimedia, además de lo anterior).
Pero de todos modos estas son todas mis configuraciones. Mi aplicación Django está en/var/www/html/django-project/helloapp
/etc/systemd/system/gunicorn.service:
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
PIDFile=/run/gunicorn/pid
User=lau
Group=lau
RuntimeDirectory=gunicorn
WorkingDirectory=/var/www/html/django-project/helloapp
ExecStart=/usr/bin/gunicorn --pid /run/gunicorn/pid \
--bind unix:/run/gunicorn/socket helloapp.wsgi
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
/etc/systemd/system/gunicorn.socket:
[Unit]
Description=gunicorn socket
[Socket]
ListenStream=/run/gunicorn/socket
[Install]
WantedBy=sockets.target
/etc/tmpfiles.d/gunicorn.conf:
d /run/gunicorn 0755 lau www-data -
/etc/apache2/apache2.conf:
<Directory /var/www/html/django-project/helloapp>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
/etc/apache2/sites-available/000-default.conf:
<VirtualHost *:80>
ProxyPass /static/ !
ProxyPass /media/ !
ProxyPass / http://localhost:8000/
</VirtualHost>
/etc/apache2/ports.conf:
Listen 80
Listen 8000
Después de reiniciar mi Apache, obtengo 403 enhttp://127.0.0.1/ohttp://127.0.0.1:8000
Forbidden
You don't have permission to access / on this server.
Apache/2.4.25 (Ubuntu) Server at localhost Port 8000
¿Algunas ideas?
Estoy en Ubuntu 17.04
EDITAR:
Veo algunos procesos de Python ejecutándose pero no estoy seguro si son correctos o no:
$ ps -wef | grep python
root 2418 1 0 06:16 ? 00:00:00 /usr/bin/python3 /usr/share/apt-xapian-index/update-apt-xapian-index-dbus
lau 25488 28678 0 23:49 pts/2 00:00:00 grep --color=auto python
lau 30605 1 0 18:30 ? 00:00:02 /var/www/html/django-project/helloapp/env/bin/python /var/www/html/django-project/helloapp/env/bin/gunicorn --workers 3 --bind unix:/var/www/html/django-project/helloapp.sock helloapp.wsgi:application
lau 30609 30605 0 18:30 ? 00:00:00 /var/www/html/django-project/helloapp/env/bin/python /var/www/html/django-project/helloapp/env/bin/gunicorn --workers 3 --bind unix:/var/www/html/django-project/helloapp.sock helloapp.wsgi:application
lau 30610 30605 0 18:30 ? 00:00:00 /var/www/html/django-project/helloapp/env/bin/python /var/www/html/django-project/helloapp/env/bin/gunicorn --workers 3 --bind unix:/var/www/html/django-project/helloapp.sock helloapp.wsgi:application
lau 30612 30605 0 18:30 ? 00:00:00 /var/www/html/django-project/helloapp/env/bin/python /var/www/html/django-project/helloapp/env/bin/gunicorn --workers 3 --bind unix:/var/www/html/django-project/helloapp.sock helloapp.wsgi:application
Respuesta1
Sé que esta es una pregunta antigua y es posible que OP haya resuelto el problema, pero hasta donde puedo ver, usted inició Gunicorn en el puerto 8000 y le dijo a Apache que escuchara el mismo puerto. Dado que dos aplicaciones están escuchando en el mismo puerto, eso probablemente crea el conflicto. A juzgar por el resultado de sus procesos, gunicorn ya se está ejecutando. Será suficiente eliminarlo Listen 8000
del archivo de configuración de Apache y reiniciar Apache nuevamente. Esto deberia resolver el problema.