{"id":321,"date":"2022-07-09T18:09:39","date_gmt":"2022-07-09T09:09:39","guid":{"rendered":"https:\/\/software.satoshis.jp\/?p=321"},"modified":"2023-04-11T14:13:59","modified_gmt":"2023-04-11T05:13:59","slug":"ubuntu%e3%81%ablaravel%e3%81%ae%e3%82%b5%e3%82%a4%e3%83%88%e3%82%92%e3%83%87%e3%83%97%e3%83%ad%e3%82%a4%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/software.satoshis.jp\/?p=321","title":{"rendered":"Ubuntu+Apache2\u306bLaravel\u306e\u30b5\u30a4\u30c8\u3092\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p> Laravel\u3067\u4f5c\u6210\u3057\u305fWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u3001Ubuntu+Apache2\u74b0\u5883\u306b\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n<p> \u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f git \u3067\u7ba1\u7406\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u524d\u63d0\u306b\u3057\u307e\u3059\u3002<\/p>\n<p> \u307e\u305a\u3001Ubuntu\u306b\u4e00\u822c\u30e6\u30fc\u30b6\u30fc\u3067\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3001Laravel\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u7528\u306e\u30d5\u30a9\u30eb\u30c0\u306b git \u304b\u3089 clone \u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ pwd\r\n\/home\/satoshis\r\n$ mkdir laravel\r\n$ cd laravel\r\n$ git clone https:\/\/example.com\/path\/hoge.git\r\n<\/pre>\n<p> \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u7528\u610f\u3057\u305f\u308a\u3001composer update \u3092\u5b9f\u884c\u3057\u305f\u308a\u306a\u3069\u3057\u3066\u3001Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u52d5\u304f\u305f\u3081\u306e\u74b0\u5883\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<p> apache2 \u306e\u30d0\u30fc\u30c1\u30e3\u30eb\u30db\u30b9\u30c8\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ sudo vi \/etc\/apache2\/sites-available\/hoge.conf\r\n<\/pre>\n<p> hoge.conf \u306e\u5185\u5bb9\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u3044\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;VirtualHost *:80&gt;\r\n\tServerName hoge.com\r\n\tServerAdmin webmaster@localhost\r\n\tDocumentRoot \/var\/www\/hoge\/public\/\r\n\tErrorLog ${APACHE_LOG_DIR}\/hoge-error.log\r\n\tCustomLog ${APACHE_LOG_DIR}\/hoge-access.log combined\r\n\tRewriteEngine on\r\n\tRewriteCond %{SERVER_NAME} = hoge.com\r\n\tRewriteRule ^ https:\/\/%{SERVER_NAME}%{REQUEST_URI} &#x5B;END,NE,R=permanent]\r\n\t&lt;Directory &quot;\/var\/www\/hoge\/public\/&quot;&gt;\r\n\t\tRequire all granted\r\n\t\tAllowOverride All\r\n\t&lt;\/Directory&gt;\r\n&lt;\/VirtualHost&gt;\r\n<\/pre>\n<p> DocumentRoot \u3092 \/var\/www\/hoge\/public \u306b\u8a2d\u5b9a\u3057\u3066\u307e\u3059\u3002<\/p>\n<p> \u4e00\u822c\u30e6\u30fc\u30b6\u30fc\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u30b7\u30f3\u30dc\u30ea\u30c3\u30af\u30ea\u30f3\u30af\u3092\u4f5c\u3063\u3066\u3001\/var\/www\/hoge \u3092\u53c2\u7167\u3059\u308b\u3068 Laravel \u306e\u30d5\u30a9\u30eb\u30c0\u304c\u898b\u3048\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ sudo ln -s \/home\/satoshis\/laravel\/hoge \/var\/www\/hoge\r\n<\/pre>\n<p> \u30b7\u30f3\u30dc\u30ea\u30c3\u30af\u30ea\u30f3\u30af\u3092\u4f5c\u3063\u305f\u3060\u3051\u3067\u306f\u3001apache2 \u304c\u52d5\u3044\u3066\u3044\u308b\u30a2\u30ab\u30a6\u30f3\u30c8\u306e www-data \u304c\u8aad\u307f\u8fbc\u3081\u306a\u3044\u306e\u3067\u3001\u6a29\u9650\u3092\u4e0e\u3048\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ pwd\r\n\/home\/satoshis\/laravel\/hoge\r\n$ chmod -R go+r .\r\n$ sudo chown www-data:www-data \/var\/www\/hoge\r\n<\/pre>\n<p> \u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ ls -l \/var\/www\/hoge\r\nlrwxrwxrwx  1 www-data www-data   30 Jul  8 17:59 hoge -&gt; \/home\/satoshis\/laravel\/hoge\r\n$ ls -lH \/var\/www\/hoge\r\ntotal 328\r\ndrwxrwxrwx  6 satoshis satoshis   4096 Jun 20 17:04 app\r\n-rwxrwxrwx  1 satoshis satoshis   1686 Jun 20 17:04 artisan\r\ndrwxrwxrwx  3 satoshis satoshis   4096 Jun 20 17:04 bootstrap\r\n-rw-rw-rw-  1 satoshis satoshis   1546 Jun 20 18:31 composer.json\r\n-rw-rw-rw-  1 satoshis satoshis 262734 Jun 20 18:31 composer.lock\r\ndrwxrwxrwx  2 satoshis satoshis   4096 Jun 20 17:30 config\r\ndrwxrwxrwx  5 satoshis satoshis   4096 Jun 20 17:04 database\r\n-rw-rw-rw-  1 satoshis satoshis   1125 Jun 20 17:04 package.json\r\n-rw-rw-rw-  1 satoshis satoshis   1138 Jun 20 17:04 phpunit.xml\r\ndrwxrwxrwx  6 satoshis satoshis   4096 Jun 20 17:04 public\r\n-rw-rw-rw-  1 satoshis satoshis   4094 Jun 20 17:04 readme.md\r\ndrwxrwxrwx  6 satoshis satoshis   4096 Jun 20 17:04 resources\r\ndrwxrwxrwx  2 satoshis satoshis   4096 Jun 20 17:04 routes\r\n-rw-rw-rw-  1 satoshis satoshis    563 Jun 20 17:04 server.php\r\ndrwxrwxrwx  5 satoshis satoshis   4096 Jun 20 17:04 storage\r\ndrwxrwxrwx  4 satoshis satoshis   4096 Jun 20 17:04 tests\r\n-rw-rw-rw-  1 satoshis satoshis      0 Jun 20 17:04 text\r\ndrwxrwxrwx 43 satoshis satoshis   4096 Jun 20 17:34 vendor\r\n-rw-rw-rw-  1 satoshis satoshis    537 Jun 20 17:04 webpack.mix.js\r\n<\/pre>\n<p> \u5927\u4e08\u592b\u3063\u307d\u3044\u3067\u3059\u306d\u3002<\/p>\n<p> \u30d0\u30fc\u30c1\u30e3\u30eb\u30db\u30b9\u30c8\u306e\u8a2d\u5b9a\u3092\u6709\u52b9\u5316\u3057\u3066\u3001apache \u306e\u8a2d\u5b9a\u3092\u8aad\u307f\u8fbc\u307e\u305b\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ sudo a2ensite hoge.conf\r\n$ sudo systemctl reload apache2\r\n<\/pre>\n<p> \u3053\u308c\u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p> SSL\u3092\u6709\u52b9\u5316\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ sudo certbot --apache\r\nSaving debug log to \/var\/log\/letsencrypt\/letsencrypt.log\r\nPlugins selected: Authenticator apache, Installer apache\r\n\r\nWhich names would you like to activate HTTPS for?\r\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r\n1: hoge.com\r\n\uff08\u7565\uff09\r\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r\nSelect the appropriate numbers separated by commas and\/or spaces, or leave input\r\nblank to select all options shown (Enter &#039;c&#039; to cancel): 1\r\nObtaining a new certificate\r\nPerforming the following challenges:\r\n\uff08\u7565\uff09\r\n\r\nPlease choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.\r\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r\n1: No redirect - Make no further changes to the webserver configuration.\r\n2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for\r\nnew sites, or if you&#039;re confident your site works on HTTPS. You can undo this\r\nchange by editing your web server&#039;s configuration.\r\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r\nSelect the appropriate number &#x5B;1-2] then &#x5B;enter] (press &#039;c&#039; to cancel): 2\r\n\r\n\uff08\u7565\uff09\r\n\r\n - If you like Certbot, please consider supporting our work by:\r\n\r\n   Donating to ISRG \/ Let&#039;s Encrypt:   https:\/\/letsencrypt.org\/donate\r\n   Donating to EFF:                    https:\/\/eff.org\/donate-le\r\n\r\n<\/pre>\n<p> apache \u306b SSL\u8a2d\u5b9a\u3092\u8aad\u307f\u8fbc\u307e\u305b\u308b\u3053\u3068\u3067\u3001https \u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ sudo systemctl reload apache2\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Laravel\u3067\u4f5c\u6210\u3057\u305fWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u3001Ubuntu+Apache2\u74b0\u5883\u306b\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u65b9\u6cd5\u3067\u3059\u3002 \u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f git \u3067\u7ba1\u7406\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u524d\u63d0\u306b\u3057\u307e\u3059\u3002 \u307e\u305a\u3001Ubuntu\u306b\u4e00\u822c\u30e6\u30fc\u30b6 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":63,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,3,49],"tags":[51,14,50,131],"class_list":["post-321","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apache","category-laravel","category-ubuntu","tag-apache2","tag-laravel","tag-ubuntu","tag-131"],"nelio_content":{"autoShareEndMode":"never","automationSources":{"useCustomSentences":false,"customSentences":[]},"efiAlt":"","efiUrl":"","followers":[1],"highlights":[],"isAutoShareEnabled":true,"networkImageIds":[],"permalinkQueryArgs":[],"series":[],"suggestedReferences":[]},"views":5195,"_links":{"self":[{"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/321","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=321"}],"version-history":[{"count":3,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/321\/revisions"}],"predecessor-version":[{"id":324,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/321\/revisions\/324"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/media\/63"}],"wp:attachment":[{"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}