2016-08-09 7 views
0

私は、Webサーバとしてui-routesとnginxを使って、角度のある静的アプリケーションを実装しています。マイ角度ルートコード:nginx 404二回目からのリダイレクト

$urlRouterProvider.otherwise('/home'); 
$locationProvider.html5Mode({ 
    enabled: false, 
    requireBase: false 
}); 
$stateProvider 
.state('home', { 
    url: '/home', 
    templateUrl: '/views/homePage.html' 
}); 

と私はそれが私のサイトのホームページにリダイレクトされ、URLは、この時にリフレッシュした後http://locahost/homeに変更するブラウザのアドレスバーにlocalhostを入力し

location/{ 
     root html/MySite; 
     index index.html index.htm; 
    } 

nginx.conf nginx 404ページにリダイレクトされます。アドレスバーにhttp://locahost/homeと入力すると、nginx 404ページがリダイレクトされます。

+0

のhttpのindex.html:// locahost /家庭の問題のタイプミスやソースのですか? –

答えて

0

nginxの場所は次のようにする必要があります:

server { 
server_name localhost; 
root html/MySite; 
index index.html; 

location/{ 
    try_files $uri $uri/ /index.html; 
} 
} 

その後、それはあなたにリダイレクトされます

関連する問題