{"id":11518,"date":"2023-03-16T10:25:41","date_gmt":"2023-03-16T01:25:41","guid":{"rendered":"https:\/\/www.stuffy.site\/computers\/?p=11453"},"modified":"2024-03-16T18:59:47","modified_gmt":"2024-03-16T09:59:47","slug":"laravelrocky-linux-%e3%83%ad%e3%82%b0%e3%82%a4%e3%83%b3ui%e3%82%92%e4%bd%9c%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.stuffy.site\/computers\/archives\/11518","title":{"rendered":"Laravel@Rocky Linux \u30ed\u30b0\u30a4\u30f3UI\u3092\u4f5c\u3063\u3066\u307f\u308b"},"content":{"rendered":"\n<p>\u4eca\u56de\u306f\u3001PHP\u306e\u958b\u767a\u74b0\u5883 Laravel \u3092Rocky Linux8 \u306eApache\u306e\u30d0\u30fc\u30c1\u30e3\u30eb\u30db\u30b9\u30c8\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u30ed\u30b0\u30a4\u30f3UI\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Laravel v10.3.3<br>PHP v8.1.16<br>Node.js v19.8.1<br>npm v9.6.2<\/p>\n\n\n\n<p>\u524d\u63d0\u3068\u3057\u3066<a href=\"https:\/\/centossrv.com\/apache-virtualhost.shtml\">\u30d0\u30fc\u30c1\u30e3\u30eb\u30db\u30b9\u30c8\u8a2d\u5b9a(Apache) | CentOS\u3067\u81ea\u5b85\u30b5\u30fc\u30d0\u30fc<\/a> \u3067Apache\u30d0\u30fc\u30c1\u30e3\u30eb\u30db\u30b9\u30c8\u69cb\u7bc9\u6e08\u307f\u3067\u3059\u3002<\/p>\n\n\n<table>\n<tbody>\n<tr>\n<td>ESXi\u30db\u30b9\u30c8<\/td>\n<td>FQDN<\/td>\n<td>DNS\u30ec\u30b3\u30fc\u30c9<\/td>\n<\/tr>\n<tr>\n<td>\u516c\u958b\u30b5\u30fc\u30d0\u30fc<\/td>\n<td>www.example.com<\/td>\n<td>\n<p>A 10.0.1.2<br \/>A 192.168.1.200<br \/>A 172.16.1.10<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\u30d0\u30fc\u30c1\u30e3\u30eb\u30db\u30b9\u30c8<\/td>\n<td>proxy.example.com<\/td>\n<td>CNAME www.example.com.<\/td>\n<\/tr>\n<tr>\n<td>DB\u30b5\u30fc\u30d0<\/td>\n<td>mysql.example.com<\/td>\n<td>&nbsp;A 192.168.1.220<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n\n<p><\/p>\n\n\n\n<p>\u53c2\u8003\u306b\u3057\u305f\u30b5\u30a4\u30c8\u306f <a href=\"https:\/\/tutorialcrawler.com\/centos-rhel\/centos-8%E3%81%ABlaravel%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95\/\">CentOS 8\u306bLaravel\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u65b9\u6cd5<\/a> <\/p>\n\n\n\n<p>\u521d\u3081\u306bPHP \u3068 Node.js yarn \u3092\u30d1\u30c3\u30b1\u30fc\u30b8\u304b\u3089\u307e\u308b\u3063\u3068\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\"># dnf install php php-curl php-bcmath php-dom php-xml php-mbstring php-json\n\n# curl -sL https:\/\/rpm.nodesource.com\/setup_19.x | bash -\n\n# curl -sL https:\/\/dl.yarnpkg.com\/rpm\/yarn.repo | sudo tee \/etc\/yum.repos.d\/yarn.repo\n\n# yum -y install nodejs gcc-c++ make yarn<\/span><\/pre>\n\n\n<p>\u7d9a\u3044\u3066\u304a\u3082\u3080\u308d\u306bPHP Composer\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3001\u30e6\u30fc\u30b6\u30fc appapi \u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\"># curl -sS https:\/\/getcomposer.org\/installer | php\n<br># mv composer.phar \/usr\/local\/bin\/composer\n<br># chmod +x \/usr\/local\/bin\/composer<br><br># useradd appapi<br><br># passwd appapi<br><\/span><\/pre>\n\n\n<p>su &#8211; \u30b3\u30de\u30f3\u30c9\u3067 appapi \u306b\u306a\u308a\u30db\u30fc\u30e0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u304a\u3044\u3066 Laravel \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\"># su - appapi<br \/><br \/>$ pwd<\/span>\n<span style=\"font-size: 14pt;\">\/home\/appapi<br \/><\/span>\n<span style=\"font-size: 14pt; color: #0000ff;\">$ composer create-project laravel\/laravel live<br \/><br \/>$ cd live<br \/><br \/>$ php artisan key:generate<\/span>\n\n<span style=\"font-size: 14pt;\">Application key set successfully.<br \/><\/span><\/pre>\n\n\n<p>\u6700\u5f8c\u306b\u3001serve \u30b3\u30de\u30f3\u30c9\u3067 Laravel \u3092\u8d77\u52d5\u3059\u308b\u3068 \u30ed\u30fc\u30ab\u30eb\u30db\u30b9\u30c8\u3092\u30d6\u30e9\u30a6\u30b6\u3067\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\">$ php artisan serve --host localhost --port=8000<\/span><\/pre>\n<pre style=\"background-color: #000000; color: #ffffff;\"> <br>  INFO  Server running on <span style=\"color: #ffff00;\">[http:\/\/192.168.1.200:8000].<\/span>\n\n  <span style=\"color: #ffff00;\">Press Ctrl+C to stop the server<br><br><\/span><\/pre>\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"829\" src=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/03\/Laravel-1-1024x829.png\" alt=\"\" class=\"wp-image-11465\" style=\"width:768px;height:622px\" srcset=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/03\/Laravel-1-1024x829.png 1024w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/03\/Laravel-1-300x243.png 300w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/03\/Laravel-1-768x622.png 768w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/03\/Laravel-1.png 1078w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u3053\u308c\u3092\u4ee5\u4e0b\u306e \/etc\/httpd\/conf.d\/laravel.conf \u30d5\u30a1\u30a4\u30eb\u3067\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u8a2d\u5b9a\u3057\u3066 serve \u30db\u30b9\u30c8\u30920.0.0.0 \u3067\u8d77\u52d5\u3057\u76f4\u3059\u3068https\u30d7\u30ed\u30c8\u30b3\u30eb\u3067\u3082\u901a\u4fe1\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\"># vi \/etc\/httpd\/conf.d\/laravel.conf<br><\/span>\n&lt;VirtualHost *:80&gt;\n    ServerName proxy.example.com\n    DocumentRoot \/var\/www\/html\/laravel\n\n    RewriteEngine on\n    RewriteRule \"^\/.well-known\/acme-challenge\" \"-\" [END]\n    RewriteRule \"^\/(.*)\" \"https:\/\/%{HTTP_HOST}\/$1\"\n  &lt;Directory \/home\/appapi\/live&gt;\n        AllowOverride All\n  &lt;\/Directory&gt;\n&lt;\/VirtualHost&gt;\n\n&lt;Proxy *&gt;\n    Require all granted\n&lt;\/Proxy&gt;<br>\nProxyPreserveHost on\nProxyRequests off\n\n&lt;VirtualHost *:443&gt;\nRequestHeader set X-Forwarded-Proto \"https\"\nProxyPass \"\/\" \"http:\/\/127.0.0.1:8000\/\"\nProxyPassReverse \"\/\" \"http:\/\/127.0.0.1:8000\/\"<br><br>\u30fb<br>\u30fb<br>\u30fb\n<\/pre>\n\n\n<p class=\"has-text-align-right\">.<\/p>\n\n\n\n<p>Apache Laravel \u518d\u8d77\u52d5\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\"># systemctl restart httpd<\/span><\/pre>\n<pre><span style=\"font-size: 14pt; color: #0000ff;\">$ php artisan serve --host 0.0.0.0 --port=8000<\/span><\/pre>\n\n\n<p><\/p>\n\n\n\n<p>\u30ea\u30e2\u30fc\u30c8\u30db\u30b9\u30c8\u3067\u3082HTTPS\u3067\u30a6\u30a7\u30eb\u30ab\u30e0\u30da\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/03\/Laravel_https_nologin.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"917\" src=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/03\/Laravel_https_nologin-1024x917.png\" alt=\"\" class=\"wp-image-11476\" style=\"width:768px;height:688px\" srcset=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/03\/Laravel_https_nologin-1024x917.png 1024w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/03\/Laravel_https_nologin-300x269.png 300w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/03\/Laravel_https_nologin-768x688.png 768w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/03\/Laravel_https_nologin.png 1075w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"has-text-align-right\">.<\/p>\n\n\n\n<p>\u4e00\u6b69\u524d\u9032\u3057\u305f\u306e\u3067 Laravel \u3067\u7c21\u5358\u306a\u30ed\u30b0\u30a4\u30f3UI\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u307e\u305a root \u6a29\u9650\u3067 appapi \u30e6\u30fc\u30b6\u30fc\u3068 sampledb \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\u3057\u3066\u30a2\u30af\u30bb\u30b9\u6a29\u9650\u3092\u4e0e\u3048\u307e\u3059\u3002<\/p>\n\n\n<pre style=\"background-color: #000000; color: #ffffff;\"># mysql -h mysql.example.com -u root -p\nEnter password:\n<span style=\"color: #ffff00;\">Welcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 11482\nServer version: 10.5.18-MariaDB MariaDB Server\n\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n<\/span>\nMariaDB [(none)]&gt; CREATE USER appapi IDENTIFIED BY 'password1234';<br>\n<span style=\"color: #ffff00;\">Query OK, 0 rows affected (0.001 sec)<\/span><br>\nMariaDB [(none)]&gt; create database sampledb default character set utf8 collate utf8_general_ci;<br>\n<span style=\"color: #ffff00;\">Query OK, 1 rows affected (0.001 sec)<\/span><br>\nMariaDB [(none)]&gt; grant all on sampledb.* to appapi@`proxy.example.com` identified by 'password1234';<br>\n<span style=\"color: #ffff00;\">Query OK, 0 rows affected (0.001 sec)<\/span><br>\nMariaDB [(none)]&gt; flush privileges;\n<span style=\"color: #ffff00;\">Query OK, 0 rows affected (0.001 sec)<br><\/span><\/pre>\n\n\n<p class=\"has-text-align-right\">.<\/p>\n\n\n\n<p>\u6b21\u306b\u4f5c\u696d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u3066 .env\u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6\u3057\u307e\u3059\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\">$ vi .env<br><\/span><\/pre>\n<pre>APP_NAME=Laravel\nAPP_ENV=local\nAPP_KEY=xxxxxxxxxxxxxxxxxxxxxx\nAPP_DEBUG=true\nAPP_URL=https:\/\/proxy.example.com\n\nDB_CONNECTION=mysql\nDB_HOST=mysql.example.com\nDB_PORT=3306\nDB_DATABASE=sampledb\nDB_USERNAME=appapi\nDB_PASSWORD=password1234<\/pre>\n\n\n<p>\u7d9a\u3044\u3066\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9 migrate \u30b3\u30de\u30f3\u30c9\u3067\u30e6\u30fc\u30b6\u30fc\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3001\u30ed\u30b0\u30a4\u30f3UI \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\">$ php artisan migrate<br><br>$ composer require laravel\/ui\n<br>$ php artisan ui vue --auth<\/span><\/pre>\n\n\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5b8c\u4e86\u3059\u308b\u3068 npm \u306e\u5b9f\u884c\u30b3\u30de\u30f3\u30c9\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\">$ npm install &amp;&amp; npm run dev<\/span><\/pre>\n\n\n<p>\u6700\u5f8c\u306b\u30d6\u30e9\u30a6\u30b6\u3067\u30ed\u30b0\u30a4\u30f3UI\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/03\/login_form-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"529\" src=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/03\/login_form-1-1024x529.png\" alt=\"\" class=\"wp-image-11519\" srcset=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/03\/login_form-1-1024x529.png 1024w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/03\/login_form-1-300x155.png 300w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/03\/login_form-1-768x397.png 768w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/03\/login_form-1.png 1155w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"has-text-align-right\">.<\/p>\n\n\n\n<p>\u30ed\u30b0\u30a4\u30f3\u30d5\u30a9\u30fc\u30e0\u306eSSL\u3092\u3059\u308b\u306b\u306f\u3001.app\/Http\/Middleware\/TrustProxies.php\u3092\u66f8\u304d\u63db\u3048\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u5177\u4f53\u7684\u306b\u306f\u3001<\/p>\n\n\n<pre><span style=\"color: #0000ff;\">$ vi .app\/Http\/Middleware\/TrustProxies.php<\/span>\n&lt;?php\n\nnamespace App\\Http\\Middleware;\n\nuse Illuminate\\Http\\Middleware\\TrustProxies as Middleware;\nuse Illuminate\\Http\\Request;\n\nclass TrustProxies extends Middleware\n{\n    \/**\n     * The trusted proxies for this application.\n     *\n     * @var array&lt;int, string&gt;|string|null\n     *\/\n    <span style=\"color: #0000ff;\">protected $proxies = '*';<\/span>\n\n    \/**\n     * The headers that should be used to detect proxies.\n     *\n     * @var int\n     *\/\n     <span style=\"color: #0000ff;\">protected $headers = Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO;<\/span>\n}\n<\/pre>\n\n\n<p><\/p>\n\n\n\n<p>Laravel \u505c\u6b62\u306f ps ax | grep 8000 \u3067 \u30d7\u30ed\u30bb\u30b9\u300cphp artisan serve &#8211;host 0.0.0.0 &#8211;port=8000\u300d\u3092PID\u304b\u3089 kill -9<\/p>\n\n\n\n<p>npm \u505c\u6b62\u306f pgrep npm | xargs kill \u307e\u305f\u306f [Ctrl]+[C] \u3067\u3059\u3002<\/p>\n\n\n\n<p>\u53c2\u8003URL\uff1a<a href=\"https:\/\/reffect.co.jp\/laravel\/laravel-authentication-understand\">Laravel\u306e\u30ed\u30b0\u30a4\u30f3\u8a8d\u8a3c\u306e\u57fa\u672c(Authentication)\u3092\u5b8c\u5168\u7406\u89e3\u3059\u308b<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/note.com\/koushikagawa\/n\/n1b5bb4a69514\">Laravel 6.0 \u3067\u300cmake:auth\u300d\u304c\u5229\u7528\u3067\u304d\u306a\u304f\u306a\u3063\u305f\u306e\u3067\u3001\u5bfe\u5fdc\u65b9\u6cd5\u8a18\u8f09\u3057\u307e\u3059\u3002<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/zakkuri.life\/laravel-chrome-security\/\">\u3010Laravel \/ Chrome\u3011\u9001\u4fe1\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u60c5\u5831\u306f\u4fdd\u8b77\u3055\u308c\u307e\u305b\u3093<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/tech.amefure.com\/php-laravel-auth-css\">\u3010Laravel\u3011auth\u306elogin\u753b\u9762\u306bCSS\u304c\u52b9\u304b\u306a\u3044\u554f\u984c\u306e\u89e3\u6c7a\u6cd5\uff01<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/egatech.net\/laravel-https\/\">Laravel\u3067HTTPS\u306b\u5bfe\u5fdc\u3059\u308b\u305f\u3081\u306e\u8a2d\u5b9a\u3068\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u56de\u306f\u3001PHP\u306e\u958b\u767a\u74b0\u5883 Laravel \u3092Rocky Linux8 \u306eApache\u306e\u30d0\u30fc\u30c1\u30e3\u30eb\u30db\u30b9\u30c8\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u30ed\u30b0\u30a4\u30f3UI\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[94,101,52,35,91],"tags":[],"class_list":["post-11518","post","type-post","status-publish","format-standard","hentry","category-apache-rocky-linux","category-laravel","category-mysql","category-php","category-rocky-linux"],"_links":{"self":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts\/11518","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/comments?post=11518"}],"version-history":[{"count":22,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts\/11518\/revisions"}],"predecessor-version":[{"id":11742,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts\/11518\/revisions\/11742"}],"wp:attachment":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/media?parent=11518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/categories?post=11518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/tags?post=11518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}