How To Install Python 3.7 On An Arch Linux Webserver

Prerequisites

  • A Vultr server running up to date Arch Linux (see this article.)
  • A running webserver, either Apache or Nginx
  • Sudo access:
    • Commands required to be ran as root are prefixed by #. The recommended way to run commands as root is to, as a regular user, prefix each of them with sudo
  • Have a text editor installed, and be familiar with it, such as vi, vim, nano, emacs or a similar editor

Install Python 3.7 On Your Webserver

On Apache

Unfortunately, it is not supported to run both versions of Apache modules (for Python 2.x and 3.x) at the same time on the same Arch system, but this is rarely a problem.

To use Python 3.x:

# pacman -S mod_wsgi

Enable the Apache mod_wsgi module by editing /etc/httpd/conf/httpd.conf, and at the end of the list of LoadModule commands, add the following:

LoadModule wsgi_module modules/mod_wsgi.so

On Nginx

To use Python 3.x:

# pacman -S uwsgi-plugin-python

Test Python

Within the appropriate directory, create test.py with the following contents:

#-*- coding: utf-8 -*-
def wsgi_app(environment, start_response):
    import sys
    output = sys.version.encode('utf8')
    status = '200 OK'
    headers = [('Content-type', 'text/plain'),
               ('Content-Length', str(len(output)))]
    start_response(status, headers)
    yield output

application = wsgi_app

On Apache

Add to the end of /etc/httpd/conf/httpd.conf, or if you are running multiple hosts, edit the appropriate configuration file, and add in the appropriate <VirtualHost> block:

WSGIScriptAlias /wsgi_app /srv/http/test.py

Restart Apache:

# systemctl restart httpd

In a web browser, visit http://YOUR-SERVER-WEB-ADDRESS-OR-IP/wsgi_app, and you will see a test page with the python and GCC versions.

Delete the test.py test file you just created, and the WSGIScriptAlias in your Apache configuration.

Restart Apache:

# systemctl restart httpd

On Nginx

Create the file /etc/uwsgi/wsgi_app.ini with the following contents:

[uwsgi]
socket = /run/uwsgi/wsgi_app.sock
uid = http
gid = http
plugins = python
chdir = /usr/share/nginx/html/
wsgi-file=test.py
callable = application

Start uWSGI serving wsqi_app:

# systemctl start uwsgi@wsgi_app

Allow Nginx to use uWSGI by editing /etc/nginx/nginx.conf, and for every server block you want to test, add the following. Alternatively, if you are using virtual hosts, edit each host's configuration file:

location ~ \wsgi_app {
    root /usr/share/nginx/html/;
    include uwsgi_params;
    uwsgi_pass unix:/run/uwsgi/wsgi_app.sock;
}

Restart Nginx:

# systemctl restart nginx

In a web browser, visit http://YOUR-SERVER-WEB-ADDRESS-OR-IP/wsgi_app, and you will see a test page with the python and GCC versions.

Delete the test.py file you just created, and the location block you just added to /etc/nginx/nginx.conf for wsgi_app.

Restart Nginx:

# systemctl restart nginx

Stop uWSGI serving wsgi_app:

# systemctl stop uwsgi@wsgi_app

Delete the /etc/uwsgi/wsgi_app.ini and test.py test files you just created.

Dejar un comentario

ZPanel y Sentora en CentOS 6 x64

ZPanel y Sentora en CentOS 6 x64

ZPanel, un panel de control de alojamiento web popular, se bifurcó en 2014 a un nuevo proyecto llamado Sentora. Aprende a instalar Sentora en tu servidor con este tutorial.

Cómo instalar Vtiger CRM Open Source Edition en CentOS 7

Cómo instalar Vtiger CRM Open Source Edition en CentOS 7

Aprende cómo instalar Vtiger CRM, una aplicación de gestión de relaciones con el cliente, en CentOS 7 para aumentar tus ventas y mejorar el servicio al cliente.

Cómo instalar el servidor Counter-Strike 1.6 en Linux

Cómo instalar el servidor Counter-Strike 1.6 en Linux

Esta guía completa le mostrará cómo configurar un servidor Counter-Strike 1.6 en Linux, optimizando el rendimiento y la seguridad para el mejor juego. Aprende los pasos más recientes aquí.

¿Puede la IA luchar con un número cada vez mayor de ataques de ransomware?

¿Puede la IA luchar con un número cada vez mayor de ataques de ransomware?

Los ataques de ransomware van en aumento, pero ¿puede la IA ayudar a lidiar con el último virus informático? ¿Es la IA la respuesta? Lea aquí, sepa que la IA es una bendición o una perdición

ReactOS: ¿Es este el futuro de Windows?

ReactOS: ¿Es este el futuro de Windows?

ReactOS, un sistema operativo de código abierto y gratuito, está aquí con la última versión. ¿Puede satisfacer las necesidades de los usuarios de Windows de hoy en día y acabar con Microsoft? Averigüemos más sobre este estilo antiguo, pero una experiencia de sistema operativo más nueva.

Manténgase conectado a través de la aplicación de escritorio WhatsApp 24 * 7

Manténgase conectado a través de la aplicación de escritorio WhatsApp 24 * 7

Whatsapp finalmente lanzó la aplicación de escritorio para usuarios de Mac y Windows. Ahora puede acceder a Whatsapp desde Windows o Mac fácilmente. Disponible para Windows 8+ y Mac OS 10.9+

¿Cómo puede la IA llevar la automatización de procesos al siguiente nivel?

¿Cómo puede la IA llevar la automatización de procesos al siguiente nivel?

Lea esto para saber cómo la Inteligencia Artificial se está volviendo popular entre las empresas de pequeña escala y cómo está aumentando las probabilidades de hacerlas crecer y dar ventaja a sus competidores.

La actualización complementaria de macOS Catalina 10.15.4 está causando más problemas que resolver

La actualización complementaria de macOS Catalina 10.15.4 está causando más problemas que resolver

Recientemente, Apple lanzó macOS Catalina 10.15.4, una actualización complementaria para solucionar problemas, pero parece que la actualización está causando más problemas que conducen al bloqueo de las máquinas Mac. Lee este artículo para obtener más información

13 Herramientas comerciales de extracción de datos de Big Data

13 Herramientas comerciales de extracción de datos de Big Data

13 Herramientas comerciales de extracción de datos de Big Data

¿Qué es un sistema de archivos de diario y cómo funciona?

¿Qué es un sistema de archivos de diario y cómo funciona?

Nuestra computadora almacena todos los datos de una manera organizada conocida como sistema de archivos de diario. Es un método eficiente que permite a la computadora buscar y mostrar archivos tan pronto como presiona buscar.