laravel Nginx

Nginx
If you are using Nginx, the following directive in your site configuration will direct all requests to the index.php front controller:

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

Of course, when using Homestead or Valet, pretty URLs will be automatically configured.

む、apacheとnginxだとroutingが違うということか。

まず、apacheのversion確認
[vagrant@localhost ~]$ httpd -v
Server version: Apache/2.2.15 (Unix)
Server built: Jun 19 2018 15:45:13

apacheのHP
https://httpd.apache.org/
Apache httpd 2.4.37 Released 2018-10-23
お、大分差がありますね。

apachectlでも確認できる。
[vagrant@localhost ~]$ apachectl -v
Server version: Apache/2.2.15 (Unix)
Server built: Jun 19 2018 15:45:13

バージョン2.2系は、2005年12月1日にリリースされ、後述する2.4系が発表されるまで主流だったバージョンであり、現在でも利用しているユーザーは少なくない

バージョン2.4系は、これまでのApacheと比べて、メモリ使用量を削減するためにシステムを改善したり、あらゆるMPMをモジュールとしてビルド可能にする新機能などを追加したりという変更を施された最新のバージョン

なるほど、2.4系が主流ってことのよう。

[vagrant@localhost ~]$ nginx -V
-bash: nginx: コマンドが見つかりません

nginx が入ってない。入れるか。

dockerでnginx

dockerのimageからnginxをpullする

vagrant@vagrant-ubuntu-trusty-64:~$ sudo docker run -d -p 8080:80 –name webserver ngiUnable to find image ‘nginx:latest’ locally
latest: Pulling from library/nginx
802b00ed6f79: Pull complete
c16436dbc224: Pull complete
683eac851b28: Pull complete
Digest: sha256:e8ab8d42e0c34c104ac60b43ba60b19af08e19a0e6d50396bdfd4cef0347ba83
Status: Downloaded newer image for nginx:latest
f8a67eabff58916d0afb8029ad64d050410d39e4ac2f64af7f2875829c010030

getting started nginx

cent-osにnginxをインストール

# rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

yum -y install nginx

here we go!
[vagrant@localhost app]$ nginx -v
nginx version: nginx/1.10.3

[vagrant@localhost app]$ sudo ps aux | grep nginx
vagrant 14953 0.0 0.1 103328 908 pts/1 S+ 10:17 0:00 grep nginx
※psコマンドは、プロセスの状態を一覧形式で表示します。オプションを省略した場合は、psコマンドを実行したユーザが起動しているプロセスのみを一覧表示します。