2017-02-02 6 views
0

をドロップし続けている。ここvagrantfilenginxのは、私はポートがここに</p> <p>を転送すると放浪を持っているポート

Vagrant.configure("2") do |config| 

    config.vm.provider "virtualbox" do |v| 
     v.memory = 2048 
     v.cpus = 4 
    end 

    config.berkshelf.enabled = true 
    config.berkshelf.berksfile_path = "./Berksfile" 
    config.omnibus.chef_version = :latest 

    config.vm.network :forwarded_port, guest: 80, host: 8080 
    config.vm.network :forwarded_port, guest: 22, host: 2020 

end 

あり、ここで

user www-data; 
worker_processes 4; 

error_log /var/log/nginx/error.log; 
pid  /var/run/nginx.pid; 

events { 
    worker_connections 1024; 
} 

http { 

    include  /etc/nginx/mime.types; 
    default_type application/octet-stream; 


    access_log /var/log/nginx/access.log; 

    sendfile on; 
    tcp_nopush on; 
    tcp_nodelay on; 

    keepalive_requests 100; 
    keepalive_timeout 65; 


    gzip on; 
    gzip_http_version 1.0; 
    gzip_comp_level 2; 
    gzip_proxied any; 
    gzip_vary off; 
    gzip_types text/plain text/css application/x-javascript text/xml application/xml application/rss+xml application/atom+xml text/javascript application/javascript application/json text/mathml; 
    gzip_min_length 1000; 
    gzip_disable  "MSIE [1-6]\."; 


    variables_hash_max_size 1024; 
    variables_hash_bucket_size 64; 
    server_names_hash_bucket_size 64; 
    types_hash_max_size 2048; 
    types_hash_bucket_size 64; 



    include /etc/nginx/conf.d/*.conf; 
    include /etc/nginx/sites-enabled/*; 
} 

がsites_enabled /デフォルト

ですnginx.confです
server { 
    listen 80; 
    server_name precise64; 

    access_log /var/log/nginx/localhost.access.log; 

    root /vagrant/site/www/public; 
    index index.php index.html index.htm; 

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

    location ~ \.php$ { 
    try_files $uri /index.php =404; 
    fastcgi_split_path_info ^(.+\.php)(/.+)$; 
    include fastcgi_params; 
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    fastcgi_pass unix:/run/php/php7.1-fpm.sock; 
    fastcgi_index index.php; 
    } 
} 

スーは私が特定のファイルにアクセスする場合

が、なぜそれが起こっている予想通り、それはリダイレクトを行いませんhttp://localhost/somedirectory

に(301)私は私のブラウザでhttp://localhost:8080/somedirectoryに行くたびに、nginxのはリダイレクト終わるということで、どのようにnginxポートを削除することを防ぐことができますか?

答えて

0

あなたのNGINX設定にリダイレクトが表示されないので、PHPアプリケーションから来ていると思います。

+0

phpスクリプトがない場合でも、どんなディレクトリでも発生します。 – m4jesticsun

+0

try_filesステートメントのデフォルトは、PHPスクリプトを実行することです。 NGINXは、ディレクトリを見つけたり、アクセス権を持っていない可能性があり、PHPスクリプトをデフォルトにしているかもしれません。あなたのアクセスログを見ることなく、もっと言いにくいです。 –

関連する問題