2016-05-20 5 views
0

をnginxのためにはlocalhost(アパッチ)から転送した後、私はローカルホスト(アパッチ)からWordpressのサイトがサーバーをライブに転送しました(nginxの) のみデフォルトのリンクが動作しても、コーデックスでは一般的なWordPressのルールに従うが、 されます404 - その他のパーマリンクサーバー

/home/wwwroot/my-domain/etc/nginx-host-subdomain-template.conf 
/home/wwwroot/my-domain/etc/nginx-host-template.conf 
/home/wwwroot/my-domain/etc/php5.2-fpm-template.conf 
/home/wwwroot/my-domain/etc/php-fpm-template.conf 
/home/wwwroot/my-domain/etc/main.conf 
/home/wwwroot/my-domain/php-fpm/go123.conf 
/home/wwwroot/my-domain/vhost/go123.conf 
/home/wwwroot/my-domain/rewrite/amh.conf 

しないでください:

私はそれを.confファイル検索グローバル私は、ファイルのパスを見つけることができなかったの/ etc/nginxの/グローバル/または/ etc/nginxの/ confには/のみ、このファイルを示しコーデックスにコードを挿入するために編集するファイルを知っている。 nginxの

+0

ローカルサーバーからライブサーバーに転送する場合、ローカルリンクをデータベース内のライブリンクと置き換える必要があります。 [検索と置換ツール](https://interconnectit.com/products/search-and-replace-for-wordpress-databases/)を使用して、その後、パーマリンクをフラッシュします。 –

+0

PermalinksがDefaultに設定されている場合はすべてのリンクが機能していますが、他のものに変更すると404となります – winresh24

+1

どのようにサーバーを管理しますか?どのホストを使用していますか? – StreetCoder

答えて

0

sudo service nginx restartまたはsudo /etc/init.d/nginx restartを使用して、nginxのサーバーを再起動します。主な問題は、mod_rewriteが有効になっていないため、ファイルがここにあるとわかりました/home/wwwroot/my-domain/rewrite/amh.confとnginxサーバーの書き換えルールを作成しました。ここ は、コードは次のとおりです。

location/{ 
     index index.php index.html; 
     if (!-e $request_filename) 
     { 
       rewrite ^/(.+)$ /index.php last; 
     } 
} 

乾杯!

1

を使用するには、私の最初の時間は、私はあなたのnginx htmlディレクトリの場所が/usr/share/nginx/htmlであり、あなたのnginxのdefault.conf場所が/etc/nginx/conf.d/default.conf

[OK]をエディタであなたのnginxのは、default.conf(/etc/nginx/conf.d/default.conf)ファイルを開くと仮定します。そして、あなたのWPのルートディレクトリ名とドメイン名とyour-wp-root-dirでアップデートyour-domain次のサーバーのブロックのコンテンツと

server { 
    listen  80; 
    server_name your-domain.com www.your-domain.com; 

    client_max_body_size 128m; 
    root /usr/share/nginx/html/your-wp-root-dir; 
    index index.php index.html index.htm; 

    location/{ 
     try_files $uri $uri/ /index.php?q=$request_uri; 
    } 
    error_page 404 /404.html; 
    error_page 500 502 503 504 /50x.html; 
    location = /50x.html { 
     root /usr/share/nginx/html; 
    } 

    location ~ \.php$ { 
     try_files $uri =404; 
     fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; 
     fastcgi_index index.php; 
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
     include fastcgi_params; 
    } 
} 

をファイルを置き換えます。

、その後は最終的にそれが動作させるものを試行錯誤した後

+0

あなたはここで 'default.conf'がどこにあるのかを見てみることができますhttp://imgur.com/0UPzwSq強調表示されているものは現在のウェブサイトです。 – winresh24

+0

管理されたホスティング環境のようですが、VPSまたは共有ホスティングがありますか?彼らが私に与えたアクセスは – Sark

+0

です。 nginxサーバーを使用するのは初めてです。 '.conf'ファイルはどこにあると思いますか?私はあなたの助けがひどく必要です。ありがとう – winresh24

関連する問題