{"id":10509,"date":"2026-01-15T15:14:44","date_gmt":"2026-01-15T06:14:44","guid":{"rendered":"https:\/\/code-plus.jp\/gp\/?p=10509"},"modified":"2026-05-28T15:43:47","modified_gmt":"2026-05-28T06:43:47","slug":"colorfulbox-python-10509","status":"publish","type":"post","link":"https:\/\/code-plus.jp\/gp\/colorfulbox-python-10509\/","title":{"rendered":"\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u30fc\u300c\u30ab\u30e9\u30d5\u30eb\u30dc\u30c3\u30af\u30b9\u300d\u3067Python FastAPI\u3092\u30c7\u30d7\u30ed\u30a4\u3057\u3001Web\u30a2\u30d7\u30ea\u3092\u516c\u958b\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>WordPress\u30d6\u30ed\u30b0\u7528\u306e\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u30fc\u3068\u3057\u3066\u4eba\u6c17\u306e\u300cColorfulBox\uff08\u30ab\u30e9\u30d5\u30eb\u30dc\u30c3\u30af\u30b9\uff09\u300d\u3067\u3059\u304c\u3001\u5b9f\u306fPython\u306eWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3082\u30c7\u30d7\u30ed\u30a4\u3067\u304d\u307e\u3059\u3002<\/p>\r\n<p>\u4eca\u56de\u3001Microsoft\u88fd\u306e\u30d5\u30a1\u30a4\u30eb\u5909\u63db\u30e9\u30a4\u30d6\u30e9\u30ea\u300cMarkItDown\u300d\u3092\u4f7f\u3063\u305f\u5909\u63db\u30c4\u30fc\u30eb\u3092ColorfulBox\u4e0a\u306b\u69cb\u7bc9\u3057\u305f\u306e\u3067\u3001\u305d\u306e\u624b\u9806\u3068\u8e0f\u3093\u3060\u5730\u96f7\u3092\u3059\u3079\u3066\u5171\u6709\u3057\u307e\u3059\u3002<\/p>\r\n<p class=\"mt-1r\"><b class=\"bold\">\u69cb\u7bc9\u3057\u305f\u3082\u306e\uff1a<\/b><\/p>\r\n<ul style=\"list-style-type:bullet;\">\r\n    <li>\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\uff1aHTML\/JavaScript\uff08WordPress\u56fa\u5b9a\u30da\u30fc\u30b8\uff09<\/li>\r\n    <li>\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\uff1aPython FastAPI + MarkItDown<\/li>\r\n    <li>\u6a5f\u80fd\uff1aPowerPoint\u3001Word\u3001PDF\u306a\u3069\u3092Markdown\u306b\u5909\u63db\u3059\u308bWeb\u30c4\u30fc\u30eb<\/li>\r\n<\/ul>\r\n\r\n<a href=\"https:\/\/code-plus.jp\/gp\/tools\/markitdown-converter\/\" class=\"linkbox my-1.5r\">\r\n<h4 class=\"linkbox-title fz-md\">pptx\/docx\/pdf \u2192 Markdown \u5909\u63db\u30c4\u30fc\u30eb<\/h4>\r\n<picture class=\"linkbox-thumbnail\">\r\n<img decoding=\"async\" width=\"300\" height=\"200\" src=\"https:\/\/code-plus.jp\/gp\/wp-content\/uploads\/pptxdoc_2601151632.jpg?ver=20260528154347\" alt=\"pptx\/docx\/pdf \u2192 Markdown \u5909\u63db\u30c4\u30fc\u30eb\" loading=\"lazy\" \/>\r\n<\/picture>\r\n<span class=\"linkbox-excerpt\">pptx\u30fbdocx\u30fbxlsx\u30fbpdf\u30fbhtml\u30fbcsv\u306a\u3069\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30c9\u30e9\u30c3\u30b0\uff06\u30c9\u30ed\u30c3\u30d7\u3059\u308b\u3060\u3051\u3067Markdown\u5f62\u5f0f\u306b\u5909\u63db\u3002Microsoft MarkItDown\u3092\u4f7f\u7528\u3057\u305f\u30aa\u30f3\u30e9\u30a4\u30f3\u5909\u63db\u30c4\u30fc\u30eb\u3002\r\n<\/span>\r\n<\/a>\r\n\r\n<!-- \u2605\u76ee\u6b21\u30ea\u30b9\u30c8 -->\r\n<ul class=\"tocList mt-1r\" data-toc-id=\"js-tocBWGD\" style=\"height:28rem\"><\/ul>\r\n<ins class=\"tocBtn is-fixed\" data-toc-id=\"js-tocBWGD\"><\/ins>\r\n\r\n\r\n\r\n\r\n\r\n<h2 class=\"fz-xl\">\u74b0\u5883\u6982\u8981<\/h2>\r\n<table class=\"table tbl-responsive\">\r\n    <thead>\r\n        <tr class=\"rung\">\r\n            <th>\u9805\u76ee<\/th>\r\n            <td>\u5185\u5bb9<\/td>\r\n        <\/tr>\r\n    <\/thead>\r\n    <tbody>\r\n        <tr class=\"rung\">\r\n            <th>\u30b5\u30fc\u30d0\u30fc<\/th>\r\n            <td>ColorfulBox \u5171\u7528\u30b5\u30fc\u30d0\u30fc\uff08cPanel \/ LiteSpeed + Passenger\uff09<\/td>\r\n        <\/tr>\r\n        <tr class=\"rung\">\r\n            <th>Python<\/th>\r\n            <td>3.11<\/td>\r\n        <\/tr>\r\n        <tr class=\"rung\">\r\n            <th>\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af<\/th>\r\n            <td>FastAPI<\/td>\r\n        <\/tr>\r\n        <tr class=\"rung\">\r\n            <th>ASGI\u30b5\u30fc\u30d0\u30fc<\/th>\r\n            <td>uvicorn<\/td>\r\n        <\/tr>\r\n        <tr class=\"rung\">\r\n            <th>\u30dd\u30fc\u30c8<\/th>\r\n            <td>8001\uff08\u30ed\u30fc\u30ab\u30eb\uff09<\/td>\r\n        <\/tr>\r\n    <\/tbody>\r\n<\/table>\r\n<h3 class=\"fz-ml\">\u524d\u63d0\u77e5\u8b58\uff1a\u306a\u305cColorfulBox\u3067FastAPI\u306f\u96e3\u3057\u3044\u306e\u304b<\/h3>\r\n<p>ColorfulBox\u306ecPanel\u306b\u306f\u300cSetup Python App\u300d\u3068\u3044\u3046\u6a5f\u80fd\u304c\u3042\u308a\u3001\u4e00\u898b\u7c21\u5358\u306bPython\u30a2\u30d7\u30ea\u3092\u52d5\u304b\u305b\u305d\u3046\u306b\u898b\u3048\u307e\u3059\u3002<\/p>\r\n<p>\u3057\u304b\u3057\u3001\u3053\u306e\u6a5f\u80fd\u306f<b class=\"bold\">Passenger<\/b>\u3068\u3044\u3046WSGI\u5411\u3051\u306e\u4ed5\u7d44\u307f\u3092\u4f7f\u3063\u3066\u304a\u308a\u3001FastAPI\u306e\u3088\u3046\u306a<b class=\"bold\">ASGI\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u306f\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u305b\u3093<\/b>\u3002<\/p>\r\n<p>\u305d\u306e\u305f\u3081\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u69cb\u6210\u3092\u53d6\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\uff1a<\/p>\r\n<pre><code class=\"language-\">\u30d6\u30e9\u30a6\u30b6 \u2192 LiteSpeed \u2192 .htaccess\uff08\u30d7\u30ed\u30ad\u30b7\uff09 \u2192 uvicorn \u2192 FastAPI\r\n<\/code><\/pre>\r\n<p>Passenger\u306f\u300cuvicorn\u3092\u8d77\u52d5\u3059\u308b\u305f\u3081\u306e\u30d6\u30fc\u30c8\u30b9\u30c8\u30e9\u30c3\u30d7\u300d\u3068\u3057\u3066\u4f7f\u3044\u3001\u5b9f\u969b\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u51e6\u7406\u306fuvicorn\u304c\u62c5\u5f53\u3057\u307e\u3059\u3002<\/p>\r\n<hr class=\"rule-hory mt-3r\">\r\n\r\n<h2 class=\"fz-xl\">Step 1: cPanel\u3067Python\u74b0\u5883\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/h2>\r\n<h3 class=\"fz-ml\">1-1. Setup Python App\u3092\u958b\u304f<\/h3>\r\n<p>cPanel\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u3001\u300c\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u300d\u2192\u300cSetup Python App\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\r\n\r\n<picture class=\"bd-bounds\"><img decoding=\"async\" src=\"https:\/\/code-plus.jp\/gp\/wp-content\/uploads\/FS-20260115-osk003.cbsv_.jp_613.png?ver=20260528154347\" alt=\"\" width=\"1160\" height=\"394\" class=\"alignnone size-full wp-image-10517\" \/><\/picture>\r\n\r\n<h3 class=\"fz-ml\">1-2. CREATE APPLICATION\u3092\u30af\u30ea\u30c3\u30af<\/h3>\r\n<h3 class=\"fz-ml\">1-3. \u8a2d\u5b9a\u3092\u5165\u529b<\/h3>\r\n<table class=\"table tbl-responsive\">\r\n    <thead>\r\n        <tr class=\"rung\">\r\n            <th>\u9805\u76ee<\/th>\r\n            <td>\u8a2d\u5b9a\u5024<\/td>\r\n            <td>\u8aac\u660e<\/td>\r\n        <\/tr>\r\n    <\/thead>\r\n    <tbody>\r\n        <tr class=\"rung\">\r\n            <th>Python version<\/th>\r\n            <td>3.11.x<\/td>\r\n            <td>\u6700\u65b0\u306e\u5b89\u5b9a\u7248\u3092\u63a8\u5968<\/td>\r\n        <\/tr>\r\n        <tr class=\"rung\">\r\n            <th>Application root<\/th>\r\n            <td><code>api\/markitdown<\/code><\/td>\r\n            <td>Python\u30d5\u30a1\u30a4\u30eb\u3092\u7f6e\u304f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea<\/td>\r\n        <\/tr>\r\n        <tr class=\"rung\">\r\n            <th>Application URL<\/th>\r\n            <td><code>\u30c9\u30e1\u30a4\u30f3<\/code> \u25be <code>api\/markitdown<\/code><\/td>\r\n            <td>\u516c\u958bURL<\/td>\r\n        <\/tr>\r\n        <tr class=\"rung\">\r\n            <th>Application startup file<\/th>\r\n            <td><code>passenger_wsgi.py<\/code><\/td>\r\n            <td>\u8d77\u52d5\u30d5\u30a1\u30a4\u30eb<\/td>\r\n        <\/tr>\r\n        <tr class=\"rung\">\r\n            <th>Application Entry point<\/th>\r\n            <td><code>application<\/code><\/td>\r\n            <td>WSGI callable\u540d<\/td>\r\n        <\/tr>\r\n    <\/tbody>\r\n<\/table>\r\n<p>\u300cCREATE\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u5b8c\u4e86\u3067\u3059\u3002<\/p>\r\n<p>\u4f5c\u6210\u5f8c\u3001\u4ee5\u4e0b\u306e\u30d1\u30b9\u304c\u81ea\u52d5\u7684\u306b\u8a2d\u5b9a\u3055\u308c\u307e\u3059\uff1a<\/p>\r\n<ul style=\"list-style-type:bullet;\">\r\n    <li>\u30a2\u30d7\u30ea\u30eb\u30fc\u30c8\uff1a<code>\/home\/(\u30e6\u30fc\u30b6\u30fc\u540d)\/api\/markitdown\/<\/code><\/li>\r\n    <li>\u4eee\u60f3\u74b0\u5883\uff1a<code>\/home\/(\u30e6\u30fc\u30b6\u30fc\u540d)\/virtualenv\/api\/markitdown\/3.11\/<\/code><\/li>\r\n<\/ul>\r\n<hr class=\"rule-hory mt-3r\">\r\n<h2 class=\"fz-xl\">Step 2: Python\u30d5\u30a1\u30a4\u30eb\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9<\/h2>\r\n<p>\u4ee5\u4e0b\u306e3\u30d5\u30a1\u30a4\u30eb\u3092 <code>\/home\/(\u30e6\u30fc\u30b6\u30fc\u540d)\/api\/markitdown\/<\/code> \u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<\/p>\r\n<h3 class=\"fz-ml\">main.py\uff08FastAPI\u30a2\u30d7\u30ea\u672c\u4f53\uff09<\/h3>\r\n<pre><code class=\"language-python\">&quot;&quot;&quot;\r\nMarkItDown Converter API\r\n&quot;&quot;&quot;\r\n\r\nimport os\r\nimport tempfile\r\nfrom fastapi import FastAPI, File, UploadFile\r\nfrom fastapi.middleware.cors import CORSMiddleware\r\nfrom fastapi.responses import JSONResponse\r\nfrom markitdown import MarkItDown\r\n\r\napp = FastAPI(title=&quot;MarkItDown Converter API&quot;, version=&quot;1.0.0&quot;)\r\n\r\n# CORS\u8a2d\u5b9a\r\napp.add_middleware(\r\n    CORSMiddleware,\r\n    allow_origins=[&quot;https:\/\/your-domain.jp&quot;],\r\n    allow_credentials=True,\r\n    allow_methods=[&quot;POST&quot;, &quot;GET&quot;, &quot;OPTIONS&quot;],\r\n    allow_headers=[&quot;*&quot;],\r\n)\r\n\r\nmd = MarkItDown(enable_plugins=False)\r\nMAX_FILE_SIZE = 50 * 1024 * 1024  # 50MB\r\n\r\n@app.get(&quot;\/api\/health&quot;)\r\nasync def health_check():\r\n    return {&quot;status&quot;: &quot;ok&quot;, &quot;service&quot;: &quot;markitdown-converter&quot;}\r\n\r\n@app.post(&quot;\/api\/markitdown\/convert&quot;)\r\nasync def convert_file(file: UploadFile = File(...)):\r\n    temp_path = None\r\n    try:\r\n        filename = file.filename or &quot;unknown&quot;\r\n        _, ext = os.path.splitext(filename)\r\n        \r\n        content = await file.read()\r\n        if len(content) &gt; MAX_FILE_SIZE:\r\n            return JSONResponse(status_code=413, content={&quot;success&quot;: False, &quot;error&quot;: &quot;\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u304c50MB\u3092\u8d85\u3048\u3066\u3044\u307e\u3059&quot;})\r\n        \r\n        with tempfile.NamedTemporaryFile(delete=False, suffix=ext) as temp_file:\r\n            temp_file.write(content)\r\n            temp_path = temp_file.name\r\n        \r\n        result = md.convert(temp_path)\r\n        \r\n        return JSONResponse(status_code=200, content={&quot;success&quot;: True, &quot;markdown&quot;: result.text_content, &quot;filename&quot;: filename})\r\n    except Exception as e:\r\n        return JSONResponse(status_code=500, content={&quot;success&quot;: False, &quot;error&quot;: f&quot;\u5909\u63db\u30a8\u30e9\u30fc: {str(e)}&quot;})\r\n    finally:\r\n        if temp_path and os.path.exists(temp_path):\r\n            os.unlink(temp_path)\r\n<\/code><\/pre>\r\n<h3 class=\"fz-ml\">passenger_wsgi.py\uff08Passenger\u7528\u30c0\u30df\u30fc\u30d5\u30a1\u30a4\u30eb\uff09<\/h3>\r\n<pre><code class=\"language-python\">&quot;&quot;&quot;\r\nPassenger\u7528\u30a8\u30f3\u30c8\u30ea\u30fc\u30dd\u30a4\u30f3\u30c8\r\nuvicorn\u306f\u5225\u30d7\u30ed\u30bb\u30b9\u3067\u8d77\u52d5\u3059\u308b\u305f\u3081\u3001\u3053\u3053\u3067\u306f\u30c0\u30df\u30fc\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u8fd4\u3059\u306e\u307f\r\n&quot;&quot;&quot;\r\n\r\ndef application(environ, start_response):\r\n    status = &quot;200 OK&quot;\r\n    headers = [(&quot;Content-Type&quot;, &quot;text\/plain; charset=utf-8&quot;)]\r\n    body = b&quot;MarkItDown API is running.&quot;\r\n    start_response(status, headers)\r\n    return [body]\r\n<\/code><\/pre>\r\n<h3 class=\"fz-ml\">requirements.txt<\/h3>\r\n<pre><code class=\"language-\">fastapi&gt;=0.109.0\r\nuvicorn&gt;=0.27.0\r\nmarkitdown[all]&gt;=0.1.0\r\npython-multipart&gt;=0.0.6\r\n<\/code><\/pre>\r\n<hr class=\"rule-hory mt-3r\">\r\n<h2 class=\"fz-xl\">Step 3: \u4f9d\u5b58\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\r\n<p>cPanel\u306e\u300c\u8a73\u7d30\u300d\u2192\u300c\u30bf\u30fc\u30df\u30ca\u30eb\u300d\u3092\u958b\u304d\u3001\u4ee5\u4e0b\u3092\u5b9f\u884c\u3057\u307e\u3059\uff1a<\/p>\r\n\r\n<picture class=\"bd-bounds\"><img decoding=\"async\" src=\"https:\/\/code-plus.jp\/gp\/wp-content\/uploads\/FS-20260115-osk003.cbsv_.jp_614.png?ver=20260528154347\" alt=\"\" width=\"1144\" height=\"334\" class=\"alignnone size-full wp-image-10519\" \/><\/picture>\r\n\r\n<pre class=\"mt-1r\"><code class=\"language-bash\"># \u65e2\u5b58\u306e\u4e0d\u8981\u306a\u30d7\u30ed\u30bb\u30b9\u3092\u7d42\u4e86\u3055\u305b\u308b\r\npkill -u peysrwib -f uvicorn\r\n\r\n# \u4eee\u60f3\u74b0\u5883\u3092\u6709\u52b9\u5316\r\nsource \/home\/(\u30e6\u30fc\u30b6\u30fc\u540d)\/virtualenv\/api\/markitdown\/3.11\/bin\/activate\r\n\r\n# \u30a2\u30d7\u30ea\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\r\ncd \/home\/(\u30e6\u30fc\u30b6\u30fc\u540d)\/api\/markitdown\r\n\r\n# \u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\r\npip install -r requirements.txt\r\n<\/code><\/pre>\r\n<p><code>markitdown[all]<\/code> \u306b\u306f\u591a\u304f\u306e\u4f9d\u5b58\u95a2\u4fc2\u304c\u3042\u308b\u305f\u3081\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306b\u306f\u6570\u5206\u304b\u304b\u308a\u307e\u3059\u3002<\/p>\r\n<hr class=\"rule-hory mt-3r\">\r\n<h2 class=\"fz-xl\">Step 4: .htaccess\u306b\u30d7\u30ed\u30ad\u30b7\u8a2d\u5b9a\u3092\u8ffd\u52a0<\/h2>\r\n<p><code>\/public_html\/api\/markitdown\/.htaccess<\/code> \u3092\u7de8\u96c6\u3057\u3001\u4ee5\u4e0b\u3092<b class=\"bold\">\u8ffd\u8a18<\/b>\u3057\u307e\u3059\uff1a<\/p>\r\n<pre><code class=\"language-apache\"># uvicorn\u3078\u306e\u30d7\u30ed\u30ad\u30b7\r\n&lt;IfModule mod_rewrite.c&gt;\r\n  RewriteEngine On\r\n  RewriteCond %{REQUEST_URI} ^\/api\/markitdown\/convert [NC]\r\n  RewriteRule ^convert$ http:\/\/127.0.0.1:8001\/api\/markitdown\/convert [P,L]\r\n  RewriteCond %{REQUEST_URI} ^\/api\/markitdown\/health [NC]\r\n  RewriteRule ^health$ http:\/\/127.0.0.1:8001\/api\/markitdown\/health [P,L]\r\n&lt;\/IfModule&gt;\r\n<\/code><\/pre>\r\n<p><b class=\"bold\">\u91cd\u8981\uff1a<\/b> cPanel\u304c\u81ea\u52d5\u751f\u6210\u3057\u305fPassenger\u8a2d\u5b9a\uff08<code># DO NOT REMOVE<\/code>\u3067\u59cb\u307e\u308b\u90e8\u5206\uff09\u306f<b class=\"bold\">\u524a\u9664\u3057\u306a\u3044\u3067\u304f\u3060\u3055\u3044<\/b>\u3002<\/p>\r\n<hr class=\"rule-hory mt-3r\">\r\n<h2 class=\"fz-xl\">Step 5: uvicorn\u3092\u8d77\u52d5<\/h2>\r\n<pre><code class=\"language-bash\"># \u65e2\u5b58\u306e\u4e0d\u8981\u306a\u30d7\u30ed\u30bb\u30b9\u3092\u7d42\u4e86\u3055\u305b\u308b\r\npkill -u peysrwib -f uvicorn\r\n\r\n# \u4eee\u60f3\u74b0\u5883\u3092\u6709\u52b9\u5316\r\nsource \/home\/(\u30e6\u30fc\u30b6\u30fc\u540d)\/virtualenv\/api\/markitdown\/3.11\/bin\/activate\r\n\r\n# \u30a2\u30d7\u30ea\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\r\ncd \/home\/(\u30e6\u30fc\u30b6\u30fc\u540d)\/api\/markitdown\r\n\r\n# uvicorn\u3092\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u3067\u8d77\u52d5\r\nnohup uvicorn main:app --host 127.0.0.1 --port 8001 &gt; uvicorn.log 2&gt;&amp;1 &amp;\r\n<\/code><\/pre>\r\n<h3 class=\"fz-ml\">\u52d5\u4f5c\u78ba\u8a8d<\/h3>\r\n<pre><code class=\"language-bash\">curl http:\/\/127.0.0.1:8001\/api\/markitdown\/health\r\n<\/code><\/pre>\r\n<p><code>{&quot;status&quot;:&quot;ok&quot;,&quot;service&quot;:&quot;markitdown-converter&quot;}<\/code> \u304c\u8fd4\u308c\u3070\u6210\u529f\u3067\u3059\uff01<\/p>\r\n<hr class=\"rule-hory mt-3r\">\r\n<h2 class=\"fz-xl\">\u8e0f\u3093\u3060\u5730\u96f7\u3068\u89e3\u6c7a\u7b56<\/h2>\r\n<h3 class=\"fz-ml\">\u5730\u96f71: Passenger\u306fASGI\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u306a\u3044<\/h3>\r\n<p><b class=\"bold\">\u75c7\u72b6\uff1a<\/b> FastAPI\u30a2\u30d7\u30ea\u304c\u52d5\u304b\u306a\u3044<\/p>\r\n<p><b class=\"bold\">\u89e3\u6c7a\uff1a<\/b> uvicorn\u3092\u5225\u30d7\u30ed\u30bb\u30b9\u3067\u8d77\u52d5\u3057\u3001.htaccess\u3067\u30d7\u30ed\u30ad\u30b7\u8ee2\u9001\u3059\u308b\u69cb\u6210\u306b\u5909\u66f4<\/p>\r\n<h3 class=\"fz-ml\">\u5730\u96f72: \u30d7\u30ed\u30ad\u30b7\u306e\u30d1\u30b9\u304c\u9593\u9055\u3063\u3066\u3044\u308b<\/h3>\r\n<p><b class=\"bold\">\u75c7\u72b6\uff1a<\/b> <code>{&quot;detail&quot;:&quot;Not Found&quot;}<\/code> \u304c\u8fd4\u308b<\/p>\r\n<p><b class=\"bold\">\u89e3\u6c7a\uff1a<\/b> .htaccess\u306eRewriteRule\u3067\u3001\u8ee2\u9001\u5148\u306e\u30d1\u30b9\u3092\u6b63\u78ba\u306b\u6307\u5b9a<\/p>\r\n<pre><code class=\"language-apache\"># \u274c \u9593\u9055\u3044\r\nRewriteRule ^api\/markitdown\/(.*)$ http:\/\/127.0.0.1:8001\/api\/$1 [P,L]\r\n\r\n# \u2705 \u6b63\u3057\u3044\r\nRewriteRule ^convert$ http:\/\/127.0.0.1:8001\/api\/markitdown\/convert [P,L]\r\n<\/code><\/pre>\r\n<h3 class=\"fz-ml\">\u5730\u96f73: \u30dd\u30fc\u30c8\u756a\u53f7\u306e\u4e0d\u4e00\u81f4<\/h3>\r\n<p><b class=\"bold\">\u75c7\u72b6\uff1a<\/b> \u300c\u30b5\u30fc\u30d0\u30fc\u3068\u306e\u901a\u4fe1\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u300d<\/p>\r\n<p><b class=\"bold\">\u89e3\u6c7a\uff1a<\/b> uvicorn\u306e\u8d77\u52d5\u30dd\u30fc\u30c8\u3068.htaccess\u306e\u30d7\u30ed\u30ad\u30b7\u5148\u30dd\u30fc\u30c8\u3092\u4e00\u81f4\u3055\u305b\u308b<\/p>\r\n<h3 class=\"fz-ml\">\u5730\u96f74: --workers 2\u3067\u30ea\u30bd\u30fc\u30b9\u4e0a\u9650\u306b\u9054\u3059\u308b<\/h3>\r\n<p><b class=\"bold\">\u75c7\u72b6\uff1a<\/b> \u300c\u30ea\u30bd\u30fc\u30b9\u304c\u4e00\u6642\u7684\u306b\u5229\u7528\u3067\u304d\u307e\u305b\u3093\u300d\u30a8\u30e9\u30fc<\/p>\r\n<p><b class=\"bold\">\u539f\u56e0\uff1a<\/b> ColorfulBox\u306e\u5171\u7528\u30b5\u30fc\u30d0\u30fc\u306b\u306f<b class=\"bold\">\u30d7\u30ed\u30bb\u30b9\u6570\u306e\u4e0a\u9650<\/b>\u304c\u3042\u308a\u307e\u3059\u3002<code>--workers 2<\/code> \u4ee5\u4e0a\u3092\u6307\u5b9a\u3059\u308b\u3068\u3001\u4e0a\u9650\u306b\u5f15\u3063\u304b\u304b\u3063\u3066\u30a8\u30e9\u30fc\u306b\u306a\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\r\n<p><b class=\"bold\">\u89e3\u6c7a\uff1a<\/b> \u30ef\u30fc\u30ab\u30fc\u6570\u3092\u6307\u5b9a\u3057\u306a\u3044\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u306f1\uff09\u304b\u3001\u660e\u793a\u7684\u306b <code>--workers 1<\/code> \u3092\u6307\u5b9a<\/p>\r\n<pre><code class=\"language-bash\"># \u274c \u554f\u984c\u304c\u8d77\u304d\u308b\u53ef\u80fd\u6027\r\nnohup uvicorn main:app --host 127.0.0.1 --port 8001 --workers 2 &gt; uvicorn.log 2&gt;&amp;1 &amp;\r\n\r\n# \u2705 \u63a8\u5968\r\nnohup uvicorn main:app --host 127.0.0.1 --port 8001 &gt; uvicorn.log 2&gt;&amp;1 &amp;\r\n<\/code><\/pre>\r\n<h3 class=\"fz-ml\">\u5730\u96f75: ffmpeg\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u306a\u3044<\/h3>\r\n<p><b class=\"bold\">\u75c7\u72b6\uff1a<\/b> \u8d77\u52d5\u6642\u306b <code>Couldn&#39;t find ffmpeg or avconv<\/code> \u306e\u8b66\u544a<\/p>\r\n<p><b class=\"bold\">\u5f71\u97ff\uff1a<\/b> \u97f3\u58f0\u30d5\u30a1\u30a4\u30eb\uff08.mp3, .wav\uff09\u306e\u5909\u63db\u304c\u3067\u304d\u306a\u3044<\/p>\r\n<p><b class=\"bold\">\u5bfe\u7b56\uff1a<\/b> \u5171\u7528\u30b5\u30fc\u30d0\u30fc\u3067\u306fffmpeg\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u306a\u3044\u305f\u3081\u3001\u97f3\u58f0\u5909\u63db\u6a5f\u80fd\u306f\u8ae6\u3081\u308b\u3002PowerPoint\u3001Word\u3001PDF\u3001Excel\u306e\u5909\u63db\u306b\u306f\u5f71\u97ff\u306a\u3057\u3002<\/p>\r\n<hr class=\"rule-hory mt-3r\">\r\n<h2 class=\"fz-xl\">\u904b\u7528\u4e0a\u306e\u6ce8\u610f\u70b9<\/h2>\r\n<h3 class=\"fz-ml\">uvicorn\u306e\u518d\u8d77\u52d5\u304c\u5fc5\u8981\u306a\u30b1\u30fc\u30b9<\/h3>\r\n<table class=\"table tbl-responsive\">\r\n    <thead>\r\n        <tr class=\"rung\">\r\n            <th>\u72b6\u6cc1<\/th>\r\n            <td>\u518d\u8d77\u52d5\u304c\u5fc5\u8981\uff1f<\/td>\r\n        <\/tr>\r\n    <\/thead>\r\n    <tbody>\r\n        <tr class=\"rung\">\r\n            <th>\u901a\u5e38\u306e\u30a2\u30af\u30bb\u30b9<\/th>\r\n            <td>\u274c \u4e0d\u8981<\/td>\r\n        <\/tr>\r\n        <tr class=\"rung\">\r\n            <th>\u30b5\u30fc\u30d0\u30fc\u518d\u8d77\u52d5\u30fb\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u5f8c<\/th>\r\n            <td>\u2705 \u5fc5\u8981<\/td>\r\n        <\/tr>\r\n        <tr class=\"rung\">\r\n            <th>uvicorn\u304c\u30af\u30e9\u30c3\u30b7\u30e5\u3057\u305f\u5834\u5408<\/th>\r\n            <td>\u2705 \u5fc5\u8981<\/td>\r\n        <\/tr>\r\n        <tr class=\"rung\">\r\n            <th>\u30b3\u30fc\u30c9\u66f4\u65b0\u6642<\/th>\r\n            <td>\u2705 \u5fc5\u8981<\/td>\r\n        <\/tr>\r\n    <\/tbody>\r\n<\/table>\r\n<h3 class=\"fz-ml\">\u518d\u8d77\u52d5\u30b3\u30de\u30f3\u30c9\uff08\u30ef\u30f3\u30e9\u30a4\u30ca\u30fc\uff09<\/h3>\r\n<pre><code class=\"language-bash\">source \/home\/(\u30e6\u30fc\u30b6\u30fc\u540d)\/virtualenv\/api\/markitdown\/3.11\/bin\/activate &amp;&amp; \r\ncd \/home\/(\u30e6\u30fc\u30b6\u30fc\u540d)\/api\/markitdown &amp;&amp; \r\npkill -u \u30e6\u30fc\u30b6\u30fc\u540d -f &quot;uvicorn main:app.*8001&quot; 2&gt;\/dev\/null; \r\nnohup uvicorn main:app --host 127.0.0.1 --port 8001 &gt; uvicorn.log 2&gt;&amp;1 &amp;\r\n<\/code><\/pre>\r\n<h3 class=\"fz-ml\">\u6b7b\u6d3b\u76e3\u8996\u30b9\u30af\u30ea\u30d7\u30c8\uff08\u30aa\u30d7\u30b7\u30e7\u30f3\uff09<\/h3>\r\n<p>cron\u3067\u5b9a\u671f\u7684\u306buvicorn\u306e\u72b6\u614b\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3001\u843d\u3061\u3066\u3044\u305f\u3089\u81ea\u52d5\u3067\u518d\u8d77\u52d5\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\r\n<hr class=\"rule-hory mt-3r\">\r\n<h2 class=\"fz-xl\">\u307e\u3068\u3081<\/h2>\r\n<p>ColorfulBox\u306e\u5171\u7528\u30b5\u30fc\u30d0\u30fc\u3067FastAPI\u3092\u52d5\u304b\u3059\u306e\u306f\u3001VPS\u307b\u3069\u81ea\u7531\u5ea6\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u5de5\u592b\u6b21\u7b2c\u3067\u5341\u5206\u5b9f\u7528\u7684\u306aWeb\u30a2\u30d7\u30ea\u3092\u516c\u958b\u3067\u304d\u307e\u3059\u3002<\/p>\r\n<p><b class=\"bold\">\u30dd\u30a4\u30f3\u30c8\uff1a<\/b><\/p>\r\n<ol style=\"list-style-type:decimal;\">\r\n    <li>Passenger\u306fASGI\u975e\u5bfe\u5fdc\u306a\u306e\u3067\u3001uvicorn\u3092\u5225\u30d7\u30ed\u30bb\u30b9\u3067\u8d77\u52d5<\/li>\r\n    <li>.htaccess\u3067\u30d7\u30ed\u30ad\u30b7\u8ee2\u9001\u306e\u8a2d\u5b9a\u3092\u884c\u3046<\/li>\r\n    <li>\u30ef\u30fc\u30ab\u30fc\u6570\u306f1\u306b\u6291\u3048\u308b\uff08\u5171\u7528\u30b5\u30fc\u30d0\u30fc\u306e\u30d7\u30ed\u30bb\u30b9\u6570\u4e0a\u9650\u5bfe\u7b56\uff09<\/li>\r\n    <li>\u30b5\u30fc\u30d0\u30fc\u518d\u8d77\u52d5\u5f8c\u306fuvicorn\u306e\u624b\u52d5\u8d77\u52d5\u304c\u5fc5\u8981<\/li>\r\n<\/ol>\r\n<p>\u500b\u4eba\u958b\u767a\u8005\u306b\u3068\u3063\u3066\u3001\u6708\u984d\u6570\u767e\u5186\u306e\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u30fc\u3067Python API\u3092\u52d5\u304b\u305b\u308b\u306e\u306f\u5927\u304d\u306a\u30e1\u30ea\u30c3\u30c8\u3067\u3059\u3002\u8a66\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\r\n<hr class=\"rule-hory mt-3r\">\r\n<h2 class=\"fz-xl\">\u53c2\u8003\u30ea\u30f3\u30af<\/h2>\r\n<ul style=\"list-style-type:bullet;\">\r\n    <li><cite><a href=\"https:\/\/www.colorfulbox.jp\/\" class=\"link\" target=\"_blank\">ColorfulBox\u516c\u5f0f\u30b5\u30a4\u30c8<\/a><\/cite><\/li>\r\n    <li><cite><a href=\"https:\/\/fastapi.tiangolo.com\/\" class=\"link\" target=\"_blank\">FastAPI\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a><\/cite><\/li>\r\n    <li><cite><a href=\"https:\/\/github.com\/microsoft\/markitdown\" class=\"link\" target=\"_blank\">Microsoft MarkItDown (GitHub)<\/a><\/cite><\/li>\r\n<\/ul>","protected":false},"excerpt":{"rendered":"ColorfulBox\uff08\u30ab\u30e9\u30d5\u30eb\u30dc\u30c3\u30af\u30b9\uff09\u306e\u5171\u7528\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u30fc\u3067Python FastAPI\u3092\u30c7\u30d7\u30ed\u30a4\u3057\u3066Web\u30a2\u30d7\u30ea\u3092\u516c\u958b\u3059\u308b\u624b\u9806\u3092\u89e3\u8aac\u3002cPanel\u306eSetup Python App\u3001uvicorn\u306e\u8d77\u52d5\u3001.htaccess\u30d7\u30ed\u30ad\u30b7\u8a2d\u5b9a\u307e\u3067\u3001\u5b9f\u969b\u306b\u30cf\u30de\u3063\u305f\u30dd\u30a4\u30f3\u30c8\u3068\u89e3\u6c7a\u7b56\u3092\u8a73\u3057\u304f\u7d39\u4ecb\u3057\u307e\u3059\u3002","protected":false},"author":1,"featured_media":10525,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","footnotes":"","vk-ltc-link":"","vk-ltc-target":"0"},"categories":[29],"tags":[555,556,550,551,553,552,417,161,87],"class_list":["post-10509","post","type-post","status-publish","format-standard","has-post-thumbnail","category-application","tag-web","tag-api","tag-colorfulbox","tag-fastapi","tag-cpanel","tag-552","tag-417","tag-python","tag-87"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/10509","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/comments?post=10509"}],"version-history":[{"count":1,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/10509\/revisions"}],"predecessor-version":[{"id":12309,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/10509\/revisions\/12309"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media\/10525"}],"wp:attachment":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media?parent=10509"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/categories?post=10509"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/tags?post=10509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}