0

私は Linux にかなり慣れていないので、Web サーバーのセットアップに少し問題があります... Varnish と phpMyAdmin で LEMP を使用しています。サーバーは実行されており、https などを介して phpMyAdmin にアクセスできます。今、インクルード /directory/*.conf; を使用して別のディレクトリに Wordpress をセットアップしようとしています。ただし、ファイルをロードしていないようです。nginx.conf に設定されたデフォルトのディレクトリのみをロードします。

これが私のnginx.confです。

user  nginx;
worker_processes  4;

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


events {
worker_connections  1024;
}


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

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';

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

sendfile        on;

keepalive_timeout  65;

include       /etc/nginx/v-hosts/*.conf;

index   index.php index.html index.htm;

server {
    listen  127.0.0.1:8080;
    root         /usr/share/nginx/html;
    location / {
    }

    error_page  404              /404.html;
    location = /40x.html {
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
    }

location ~ \.php$ {
  root   /usr/share/nginx/html;
  fastcgi_split_path_info  ^(.+\.php)(.*)$;
  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;
}
location ~* ^/stolenmx.com/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { root /srv/www/;
}

location ~ \.php$ {
  root   /usr/share/nginx/html;
  fastcgi_split_path_info  ^(.+\.php)(.*)$;
  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;
}
}


server {
listen       443;
client_max_body_size 80M;    

ssl                  on;
ssl_certificate      /etc/nginx/ssl/server.crt;
ssl_certificate_key  /etc/nginx/ssl/server.key;

ssl_session_timeout  5m;

ssl_protocols  SSLv2 SSLv3 TLSv1;
ssl_ciphers  HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers   on;

location / {
root   /usr/share/nginx/html;
index  index.html index.htm;
}
location ~* ^/phpMyAdmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { root /usr/share/;
}

location ~ \.php$ {
  root   /usr/share/nginx/html;
  fastcgi_split_path_info  ^(.+\.php)(.*)$;
  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;
}
}
}

そして、これがワードプレス用にロードしようとしている私のファイルです。

server {
server_name stolenmx.com;
listen 8080;
access_log /var/log/nginx/stolenmx.com-access.log;
error_log /var/log/nginx/stolenmx.com-error.log;
root /srv/www/stolenmx.com;

location / {
    index index.php;
}

# Disable favicon.ico logging
location = /favicon.ico {
    log_not_found off;
    access_log off;
}

# Allow robots and disable logging
location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
}

# Enable permalink structures
if (!-e $request_filename) {
    rewrite . /index.php last;
}

# Handle php requests
location ~ \.php$ {
    include /etc/nginx/fastcgi_params;
    fastcgi_pass  unix:/var/run/php-fpm/php-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME /srv/www/stolenmx.com$fastcgi_script_name;
}

# Disable static content logging and set cache time to max
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    expires max;
    log_not_found off;
}

# Deny access to htaccess and htpasswd files
location ~ /\.ht {
    deny  all;
}
}

このファイル ディレクトリを nginx.conf に含めました "include /etc/nginx/v-hosts/*.conf;" しかし、何らかの理由でロードされておらず、server_name が /srv/www/ を指していませんか?

追加の server.conf をロードしない理由について何か提案はありますか?

ワードプレスのインストールを /usr/share/nginx/html にドラッグすると機能しますが、サーバーを複数持つことはできません。それは私のnginx.confに関係していると思いますが、何を変更/追加すればよいかわかりませんか?

よろしく 狡猾

4

1 に答える 1

0

変更が影響を与える前に、nginx を再起動/リロードする必要があります。CentOS では、次を実行して実行します。

/etc/init.d/nginx restart

(root でない場合は sudo を使用)

含まれるすべてのファイルの末尾に「.conf」を付ける必要があります。ファイルにこの拡張子が付いていることを確認してください。最後に、8080 でリッスンするように Wordpress サーバーを構成しましたが、このポートを確認しましたか?

于 2015-01-31T18:03:00.807 に答える