저는 리눅스가 처음이고 웹 서버를 설정하는 데 약간의 문제가 있습니다 ... 나는 Varnish와 phpMyAdmin을 사용하여 LEMP를 사용하고 있습니다. 서버가 실행 중이고 https 등을 통해 phpMyAdmin에 액세스 할 수 있습니다. 이제 include /directory/*.conf를 사용하여 다른 디렉토리에 Wordpress를 설치하려고합니다. 그러나 그것은 파일을로드하지 않는 것 같습니다. 그것은 단지,nginx가로드되지 않습니다 (추가 호스트 포함/*. conf;) 디렉토리를 변경하지 않겠습니까? centos7
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;
}
}
}
을 nginx.conf
여기 내 nginx.conf가의에서 설정 한 기본 디렉토리를로드 그리고 여기 내가 워드 프레스에 대한로드하기 위해 노력하고있어 내 파일,
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;
}
}
I입니다 nginx.conf에이 파일 디렉토리를 포함 시켰습니다. "include /etc/nginx/v-hosts/*.conf;" 하지만 그것은 어떤 이유로로드되지 않고 server_name이/srv/www /를 가리 키지 않을 것입니다.
다른 사람이 server.conf를 추가로로드하지 않는 이유에 대한 제안 사항이 있습니까?
나는 wordpress를/usr/share/nginx/html로 끌어다 놓을 수는 있지만 작동하지만 하나 이상의 서버를 가질 수는 없다. 나는 그것이 내 nginx.conf와 관련이 있다고 생각하지만 변경/추가 할 것인지 확실하지 않습니까?
감사 교활
안녕하십니까, '시스템 다시 시작 nginx'를 사용하여 nginx를 여러 번 다시 시작했지만 여전히 변경 사항이 없습니다. 파일은 서버 설정 파일이므로이 확장자 여야합니다. 마지막으로 포트 80에서 캐시 파일을 실행하고 표시하지만 캐시 할 수 있도록 8080의 라이브 사이트를 수신하는 바니시 캐시를 사용하고 있습니다. –