
VirtualBox
私はMacにインストールし、 settings
VitualBoxで変更しましたAdapter 1 - Attached to: Host-only Adapter, Name: vboxnet0
。
ゲストアドオンをインストールします
./VBoxLinuxAdditions.run
。「設定」>「共有フォルダ」>「新しい共有フォルダ定義を追加します。」>「自動マウント」
アクセスすると、domain1.com.localhost
フォルダーNo input file specified..
が存在することを確認し、マウントが成功したようです。access.log
を確認すると404
、フォルダーの/media/sf_Sites
アクセス許可が間違っているのか、それとも私が見落としているのか疑問に思います。
ls -l /メディア/sf_Sites
drwxrwx---. 1 root vboxsf domain1.com
vi /etc/nginx/nginx.conf
user nginx;
vi /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name domain1.com.localhost www.domain1.com.localhost
access_log /var/log/nginx/domain1.com.access.log;
root /media/sf_Sites/domain1.com;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$query_string;
location /robots.txt {
alias /media/sf_Sites/domain1.com/app/robots.txt;
}
location ^/(images/|javascripts) {
root /media/sf_Sites/domain1.com/app/assets;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 32k;
fastcgi_buffers 8 32k;
}
}
私のMacでは
sudo vi /etc/hosts
192.168.56.101 domain1.com.localhost
アップデート
フォルダを/var/www/html/にマウントします
mkdir /var/www/html/Sites
mount -t vboxsf Sites -o rw,dmode=777,gid=0,uid=0 /var/www/html/Sites
nginxの設定を変更して試してみるroot /var/www/html/Sites
と、
domain1.com.localhost
403 Forbidden
domain1.com.localhost/info.php
No input file specified
domain1.com.localhost/index.html
No input file specified
ls -l /var/www/html/Sites
-rwxrwxrwx. 1 ルート ルート index.html -rwxrwxrwx. 1 ルート ルート info.php drwxrwxrwx. 1 ルート ルート domain1.com
しかし、ログインした VirtualBox のルート ユーザーとしてファイルを作成し、その下に index.html ファイルを作成し/var/www/html/index.html
、nginx 構成のルートを変更すると、ファイルにアクセスできます...
なぜ???
nginxユーザーも変更してみました
vi /etc/nginx/nginx.conf
user nginx; > user root;
まだ動作しません...