• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Thursday, May 22, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Arch

How To Install Python 3.7 On An Arch Linux Webserver

How VPS by How VPS
August 8, 2019
in Arch, Uncategorized
0
0
SHARES
23
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Prerequisites
  2. Install Python 3.7 On Your Webserver
    1. On Apache
    2. On Nginx
  3. Test Python
    1. On Apache
    2. On Nginx
  4. Want to contribute?


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.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

How to Install Perl 5.28 on an Arch Linux Webserver

Next Post

How to Install MariaDB 10.3 or MySQL 8.0 on Arch Linux

Next Post

How to Install MariaDB 10.3 or MySQL 8.0 on Arch Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet