npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

apache-module-manager

v1.0.1

Published

A CLI tool for enabling/disabling Apache modules

Downloads

4

Readme

Apache Module Manager

npm package version Travis build status npm package downloads code style license

asciicast

A CLI tool for enabling/disabling Apache modules.

Installation

$ npm install --global apache-module-manager

Note

This will modify your Apache config file. It is your responsibility to make a backup. This has only been tested on macOS with the default Apache installation. Use at your own risk.

Usage

list|l [-d -e -s <columns>] [search]

List/search for modules.

Options

| Long | Short | Description | |------------|-------|--------------------------------------------------------------------------------| | --disabled | -d | Only display disabled modules | | --enabled | -e | Only display enabled modules | | --sort | -s | A comma separated list of columns to sort by (defaults to enabled,name,path) |

Examples

# Display all modules
$ amm list
$ amm l

# Display modules that contain 'php'
$ amm list php

# Display all modules and sort them by their line number
$ amm list --sort line

# Display all currently enabled modules
$ amm list -e
Example Output
$ amm list -s line

ID  NAME                       PATH                                                ENABLED LINE
0   authn_file_module          libexec/apache2/mod_authn_file.so                   true    71
1   authn_dbm_module           libexec/apache2/mod_authn_dbm.so                    false   72
2   authn_anon_module          libexec/apache2/mod_authn_anon.so                   false   73
3   authn_dbd_module           libexec/apache2/mod_authn_dbd.so                    false   74
4   authn_socache_module       libexec/apache2/mod_authn_socache.so                false   75
5   authn_core_module          libexec/apache2/mod_authn_core.so                   true    76
6   authz_host_module          libexec/apache2/mod_authz_host.so                   true    77
7   authz_groupfile_module     libexec/apache2/mod_authz_groupfile.so              true    78
8   authz_user_module          libexec/apache2/mod_authz_user.so                   true    79
9   authz_dbm_module           libexec/apache2/mod_authz_dbm.so                    false   80
...

enable|e <search>

Enable a module. If multiple modules match the search term, a select prompt will be displayed allowing you to choose from the matches. The sudo prefix is required since the script modifies a system file.

Examples

$ sudo amm enable php
$ sudo amm e php
Example Output
$ sudo amm enable php

? Which module are you looking for? (Use arrow keys)
  php7_module libexec/apache2/libphp7.so
❯ php5_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp5.so
? Enable php5_module (/usr/local/opt/[email protected]/lib/httpd/modules/libphp5.so)? (Y/n)
✔ Changed line 180 to LoadModule php5_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp5.so
? Restart Apache (/usr/sbin/apachectl restart)? (Y/n)

disable|d <search>

Disable a module. If multiple modules match the search term, a select prompt will be displayed allowing you to choose from the matches. The sudo prefix is required since the script modifies a system file.

Examples

$ sudo amm disable php
$ sudo amm d php
Example Output
$ sudo amm disable php

? Disable php5_module (/usr/local/opt/[email protected]/lib/httpd/modules/libphp5.so)? (Y/n)
✔ Changed line 180 to #LoadModule php5_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp5.so
? Restart Apache (/usr/sbin/apachectl restart)? (Y/n)

switch <old/new search> [new search]

Disable a module and enable another one. If only one argument is given, the first argument will be used to search for both the module to disable and the module to enable. If multiple modules match a search term, a select prompt will be displayed allowing you to choose from the matches. The sudo prefix is required since the script modifies a system file.

Examples

$ sudo amm switch php5 php7
$ sudo amm s php
Example Output
$ sudo amm switch php

? Disable php5_module (/usr/local/opt/[email protected]/lib/httpd/modules/libphp5.so)? (Y/n)
✔ Changed line 180 to #LoadModule php5_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp5.so
? Enable php7_module (libexec/apache2/libphp7.so)? (Y/n)
✔ Changed line 176 to LoadModule php7_module libexec/apache2/libphp7.so
? Restart Apache (/usr/sbin/apachectl restart)? (Y/n)

Config File

By default, AMM will check if the file ~/.amm.json exists and load config options from it.

Default Config

{
  "apache_config": "/etc/apache2/httpd.conf",
  "apache_restart": "/usr/sbin/apachectl restart"
}

Global Options

These options can be used with any of the above commands:

| Long | Short | Description | |-----------------|-------|-----------------------------------------------| | --version | -V | Display current Apache Module Manager version | | --apache-config | -a | Path to the Apache config file | | --config | -c | Path to AMM config file | | --help | -h | Display help information |

Environment Variables

These environment variables can be used to change different config options:

| Variable | Description | |-------------------|--------------------------------| | AMM_CONFIG | Path to an AMM config file | | AMM_APACHE_CONFIG | Path to the Apache config file |

TODO/Ideas

  • [ ] Automated testing
  • [ ] Better Linux support/testing
  • [ ] Support for multiple Apache config files (file traversing?)
  • [ ] Allow for multiple modules to be enabled/disabled at the same time
  • [ ] Automated Apache config file backups
  • [ ] Implement module so that AMM can be used by other packages
  • [ ] Implement add and remove commands to add/remove LoadModule lines from config

Frequently Asked Questions

Doesn't a2enmod/a2dismod do the same thing?

Currently, yes. I built this before I knew that a2enmod/a2dismod could be installed on macOS. However, AMM has a nicer interface and I would like to extend the functionality of it in the near future.

Don't you mean httpd instead of Apache?

Yes, however plenty of people refer to it as Apache and you know what I'm talking about.

License

MIT. See the license.md file for more info.