質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.47%
Cloud9

Cloud9は、クラウドからのプログラミングが可能になるWebサービス。IDEとしての機能が搭載されており、GitHubやHerokuなど他ツールとの連携も可能です。ブラウザ上で動くため、デバイスに関係なく開発環境を準備できます。

terminal

Terminalは、Apple社のmacOSに標準で付属しているUNIX端末エミュレータ。UNIXコマンドによってMacの操作および設定を行うことができます。

Laravel

LaravelとはTaylor Otwellによって開発された、オープンソースなPHPフレームワークです。Laravelはシンプルで表現的なシンタックスを持ち合わせており、ウェブアプリケーション開発の手助けをしてくれます。

artisan

artisanは、PHP Laravelフレームワークのコマンドの事です。 Artisanコマンドを使う事で、DBのテーブルやバンドル等を追加することができるコマンドです。

composer

Composerとは、PHP5.3.2以上で使用可能なパッケージ管理ツールです。指定ディレクトリ内だけでパッケージ管理します。

Q&A

解決済

1回答

6411閲覧

「php artisan serve」をしても ローカルホストでLaravelの画面が表示されない

Nishin

総合スコア30

Cloud9

Cloud9は、クラウドからのプログラミングが可能になるWebサービス。IDEとしての機能が搭載されており、GitHubやHerokuなど他ツールとの連携も可能です。ブラウザ上で動くため、デバイスに関係なく開発環境を準備できます。

terminal

Terminalは、Apple社のmacOSに標準で付属しているUNIX端末エミュレータ。UNIXコマンドによってMacの操作および設定を行うことができます。

Laravel

LaravelとはTaylor Otwellによって開発された、オープンソースなPHPフレームワークです。Laravelはシンプルで表現的なシンタックスを持ち合わせており、ウェブアプリケーション開発の手助けをしてくれます。

artisan

artisanは、PHP Laravelフレームワークのコマンドの事です。 Artisanコマンドを使う事で、DBのテーブルやバンドル等を追加することができるコマンドです。

composer

Composerとは、PHP5.3.2以上で使用可能なパッケージ管理ツールです。指定ディレクトリ内だけでパッケージ管理します。

0グッド

0クリップ

投稿2020/10/04 03:48

現在、AWS cloud9にて、LaravelでToDoアプリを制作することを試みています。

terminalにて、phpのバージョンアップとLaravelのインストール、Composerの立ち上げまではうまくいったようなのですが、Laravel用に制作したプロジェクトディレクトリにcdコマンドで移動してから、「php artisan serve --port=8080」と打ち込んで表示されたアドレス(host=127.0.0.1)にアクセスしても、Laravelの画面が表示されず、「127.0.0.1で接続が拒否されました」と出てしまいます。
「php artisan --host=127.0.0.1 --port=9999」でも同様で、「sudo php artisan serve --port=80」のように他のポート番号で試みてもLaravelの画面は表示されませんでした。

cloud9でなく、PCのローカルには、使用していないVagrant,VirtualBox,PuTTyがあり、こちらが接続に影響しているのではないか、と見てアンインストールして再試行してみても、結局は依然として接続が拒否されたまま、現在に至ります。

どのような操作をすれば、正常にLaravelの画面が表示されるでしょうか。

cloud9では現在、t2.microでenvironmentを設定しています。terminalで確認したメモリの状況は以下のとおりです。

ec2-user:~/environment $ cd laravel-quest ec2-user:~/environment/laravel-quest $ df -a Filesystem 1K-blocks Used Available Use% Mounted on proc 0 0 0 - /proc sysfs 0 0 0 - /sys devtmpfs 493872 60 493812 1% /dev devpts 0 0 0 - /dev/pts tmpfs 504564 0 504564 0% /dev/shm /dev/xvda1 10188068 10059796 28024 100% / devpts 0 0 0 - /dev/pts none 0 0 0 - /proc/sys/fs/binfmt_misc cgroup 0 0 0 - /cgroup/blkio cgroup 0 0 0 - /cgroup/cpu cgroup 0 0 0 - /cgroup/cpuacct cgroup 0 0 0 - /cgroup/cpuset cgroup 0 0 0 - /cgroup/devices cgroup 0 0 0 - /cgroup/freezer cgroup 0 0 0 - /cgroup/hugetlb cgroup 0 0 0 - /cgroup/memory cgroup 0 0 0 - /cgroup/perf_event cgroup 0 0 0 - /cgroup/pids /dev/xvda1 10188068 10059796 28024 100% /var/lib/docker

php,composer,そしてLaravelで作成されたenvファイルの内容は、以下のとおりです。

php

1ec2-user:~/environment $ php -v 2PHP 7.2.33 (cli) (built: Aug 21 2020 22:46:12) ( NTS ) 3Copyright (c) 1997-2018 The PHP Group 4Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

composer

1ec2-user:~/environment $ composer -v 2 3Composer version 1.10.13 2020-09-09 11:46:34 4 5Usage: 6 command [options] [arguments] 7 8Options: 9 -h, --help Display this help message 10 -q, --quiet Do not output any message 11 -V, --version Display this application version 12 --ansi Force ANSI output 13 --no-ansi Disable ANSI output 14 -n, --no-interaction Do not ask any interactive question 15 --profile Display timing and memory usage information 16 --no-plugins Whether to disable plugins. 17 -d, --working-dir=WORKING-DIR If specified, use the given directory as working directory. 18 --no-cache Prevent use of the cache 19 -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug 20 21Available commands: 22 about Shows the short information about Composer. 23 archive Creates an archive of this composer package. 24 browse Opens the package's repository URL or homepage in your browser. 25 cc Clears composer's internal package cache. 26 check-platform-reqs Check that platform requirements are satisfied. 27 clear-cache Clears composer's internal package cache. 28 clearcache Clears composer's internal package cache. 29 config Sets config options. 30 create-project Creates new project from a package into given directory. 31 depends Shows which packages cause the given package to be installed. 32 diagnose Diagnoses the system to identify common errors. 33 dump-autoload Dumps the autoloader. 34 dumpautoload Dumps the autoloader. 35 exec Executes a vendored binary/script. 36 fund Discover how to help fund the maintenance of your dependencies. 37 global Allows running commands in the global composer dir ($COMPOSER_HOME). 38 help Displays help for a command 39 home Opens the package's repository URL or homepage in your browser. 40 i Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json. 41 info Shows information about packages. 42 init Creates a basic composer.json file in current directory. 43 install Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json. 44 licenses Shows information about licenses of dependencies. 45 list Lists commands 46 outdated Shows a list of installed packages that have updates available, including their latest version. 47 prohibits Shows which packages prevent the given package from being installed. 48 remove Removes a package from the require or require-dev. 49 require Adds required packages to your composer.json and installs them. 50 run Runs the scripts defined in composer.json. 51 run-script Runs the scripts defined in composer.json. 52 search Searches for packages. 53 self-update Updates composer.phar to the latest version. 54 selfupdate Updates composer.phar to the latest version. 55 show Shows information about packages. 56 status Shows a list of locally modified packages, for packages installed from source. 57 suggests Shows package suggestions. 58 u Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file. 59 update Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file. 60 upgrade Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file. 61 validate Validates a composer.json and composer.lock. 62 why Shows which packages cause the given package to be installed. 63 why-not Shows which packages prevent the given package from being installed.

env

1APP_NAME=Laravel 2APP_ENV=local 3APP_KEY=base64:IXLskHypnfar4T7JUWaIRe970FEomK0FJQuJy3vb+5c= 4APP_DEBUG=true 5APP_LOG_LEVEL=debug 6APP_URL=http://localhost 7 8DB_CONNECTION=mysql 9DB_HOST=127.0.0.1 10DB_PORT=3306 11DB_DATABASE=homestead 12DB_USERNAME=homestead 13DB_PASSWORD=secret 14 15BROADCAST_DRIVER=log 16CACHE_DRIVER=file 17SESSION_DRIVER=file 18SESSION_LIFETIME=120 19QUEUE_DRIVER=sync 20 21REDIS_HOST=127.0.0.1 22REDIS_PASSWORD=null 23REDIS_PORT=6379 24 25MAIL_DRIVER=smtp 26MAIL_HOST=smtp.mailtrap.io 27MAIL_PORT=2525 28MAIL_USERNAME=null 29MAIL_PASSWORD=null 30MAIL_ENCRYPTION=null 31 32PUSHER_APP_ID= 33PUSHER_APP_KEY= 34PUSHER_APP_SECRET= 35PUSHER_APP_CLUSTER=mt1

記述の至らぬところもあるかと存じますが、畏れながら、解決方法やヒントのご教示をお願いします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

https://qiita.com/kutarou197/items/c0bfab742fa1d67c042c

Cloud9の右上の「Preview」をクリックして、Preview Running Applicationをクリックする。

投稿2020/10/04 05:21

kyoya0819

総合スコア10429

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Nishin

2020/10/04 06:14

そうでしたか!右上の「Preview」から入るのですね。 先程試行してみましたが、おかげさまでterminalの右横に「Laravel」のメイン画面が無事表示されました。 これでアプリ開発をLaravelで続行できそうです。 助かりました。感謝申し上げます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.47%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問