==== Servidor web Apache ==== [[https://httpd.apache.org/|httpd.apache.org]] \\ la configuracion del servidor Apache esta en **/etc/apache2/apache2.conf**\\ Los archivos del sitio estan en **/var/www**\\ cambiar esta carpeta al grupo www-data con permiso lectura y escritura.\\ poner tu usuario en el grupo www-data\\ Para poder ejecutar scripts Python, es necesario habilitar el módulo [[http://httpd.apache.org/docs/current/mod/mod_cgi.html|mod_cgi]]\\ '' sudo a2enmod cgid '' habilitar cgi\\ dentro del archivo ‘apache2.conf’ \\ dentro de la etiqueta agregar:\\ \\ Options +ExecCGI \\ AddHandler cgi-script .py \\ \\ sudo systemctl restart apache2 \\ '' $ sudo service apache2 restart'' para que surtan efecto los cambios realizados, reiniciar el servidor Apache\\ ---- [[https://modpython.org/live/current/doc-html/contents.html|modpython.org]] is an Apache module that embeds the Python interpreter \\ Si ya tenemos python y apache corriendo (en linux debian)\\ apt-get install libapache2-**mod-wsgi**\\ [[https://howtoforge.es/como-ejecutar-scripts-de-python-con-apache-y-mod-wsgi-en-ubuntu-20-04/|como-ejecutar-scripts-de-python-con-apache-y-mod-wsgi]] \\ archivo /var/www/html/algo.py def application(environ,start_response): html = '\n' \ '\n' \ '
\n' \ 'Welcome to mod_wsgi Test Page\n' \ '
\n' \ '\n' \ '\n' status = '200 OK' response_header = [('Content-type','text/html')] start_response(status,response_header) return [html]
'' chown www-data:www-data /var/www/html/algo.py '' para cambiar el dueño del archivo\\ \\