{"id":16163958,"url":"https://github.com/rawleyfowler/mojolicious-mod-perl-example","last_synced_at":"2026-01-29T23:02:51.980Z","repository":{"id":204764888,"uuid":"712446245","full_name":"rawleyfowler/mojolicious-mod-perl-example","owner":"rawleyfowler","description":"An example of running Mojolicious under Apache2 \u0026 mod_perl.","archived":false,"fork":false,"pushed_at":"2023-10-31T20:12:42.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T11:35:06.449Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rawleyfowler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-31T13:43:01.000Z","updated_at":"2024-03-10T08:18:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"ba581532-c27c-45a5-8d90-1a8aa70cdbea","html_url":"https://github.com/rawleyfowler/mojolicious-mod-perl-example","commit_stats":null,"previous_names":["rawleyfowler/mojolicious-mod-perl-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rawleyfowler/mojolicious-mod-perl-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rawleyfowler%2Fmojolicious-mod-perl-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rawleyfowler%2Fmojolicious-mod-perl-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rawleyfowler%2Fmojolicious-mod-perl-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rawleyfowler%2Fmojolicious-mod-perl-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rawleyfowler","download_url":"https://codeload.github.com/rawleyfowler/mojolicious-mod-perl-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rawleyfowler%2Fmojolicious-mod-perl-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28889863,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T21:06:44.224Z","status":"ssl_error","status_checked_at":"2026-01-29T21:06:42.160Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T02:44:52.848Z","updated_at":"2026-01-29T23:02:51.958Z","avatar_url":"https://github.com/rawleyfowler.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Running mod_perl with Mojolicious in Docker\n\n### Generate your config\n\nThanks to \u003ca href=\"https://github.com/motemen/docker-mod_perl\"\u003emotemen\u003c/a\u003e for some nicely pre-configured\n`mod_perl` and `Apache2` images.\n\n```\ndocker run --rm motemen/mod_perl:5.36.0-2.4.58 cat /usr/local/apache2/conf/httpd.conf \u003e httpd.conf\necho 'Include /usr/local/apache2/conf/mojolicious.conf' \u003e\u003e httpd.conf\n```\n\n### Enable Prefork MPM instead of Event MPM\n\nIn `httpd.conf`:\n\n```apache\n#LoadModule mpm_event_module modules/mod_mpm_event.so\nLoadModule mpm_prefork_module modules/mod_mpm_prefork.so\n```\n\n### Write your application\n\nIn `lib/App.pm`:\n\n```perl\npackage App;\n\nuse 5.036;\n\nuse Mojolicious::Lite -signatures;\n\nsub get_app { app; }\n\nget '/' =\u003e sub {\n    shift-\u003erender( text =\u003e \"Hello World!\" );\n};\n\n1;\n```\n\n### Write your Plack shim\n\nIn `app.psgi`:\n\n```perl\nuse 5.036;\n\nuse lib 'lib';\nuse App;\nuse Plack::Builder;\n\nbuilder {\n  App::get_app-\u003estart;\n};\n```\n\n### Write your mod_perl apache conf\n\nIn `mojolicious.conf`:\n\n```apache\nLoadModule perl_module modules/mod_perl.so\n\n\u003cVirtualHost *:80\u003e\n    \u003cLocation /\u003e\n        SetHandler perl-script\n        PerlResponseHandler Plack::Handler::Apache2\n        PerlSetVar psgi_app /app.psgi\n    \u003c/Location\u003e\n\u003c/VirtualHost\u003e\n```\n\n### Write your Dockerfile\n\nIn `Dockerfile`:\n\n```docker\nFROM motemen/mod_perl:5.36.0-2.4.58-2.0.13\nCOPY app.psgi /app.psgi\nCOPY lib /usr/local/apache2/lib\nCOPY httpd.conf /usr/local/apache2/conf/httpd.conf\nCOPY mojolicious.conf /usr/local/apache2/conf/mojolicious.conf\nRUN apt-get update -y \u0026\u0026 apt-get install -y wget make build-essential\nRUN cpan -iT Plack Mojolicious\nEXPOSE 80\nCMD [\"httpd-foreground\"]\n```\n\n### Run with docker\n\n```shell\n$ docker build . -t mod-perl\n$ docker run -p 80:80 mod-perl\n$ curl http://localhost:80/\n```\n\nYou should see `Hello World!`.\n\n### Running with auto-reloading (for development)\n\nYou can make this auto-reload if you use a volume for `lib/` against `/usr/local/apache2/lib/`\n\n\u003chr\u003e\n\nOriginally posted on \u003ca href=\"https://rawley.xyz/docker-mod-perl.html\"\u003eMy Website\u003c/a\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frawleyfowler%2Fmojolicious-mod-perl-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frawleyfowler%2Fmojolicious-mod-perl-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frawleyfowler%2Fmojolicious-mod-perl-example/lists"}