0
나는 nginx 서버에서 초보자입니다.NGINX가 CSS를로드 할 수 없습니다
내 서버는 Centos입니다.
LEMP를 사용하여 서버를 설정하는 방법을 여러 웹에서 검색합니다. 내 웹 사이트에서 .htaccess를 사용하여 nginx가 지원되지 않는 URL을 다시 작성한 경우 try_files이 도움이되지만 CSS를로드 할 수 없습니다.
> Resource interpreted as Stylesheet but transferred with MIME type
> text/html: "http://stg-owners.tamahome.jp/style.css".
나는 여기에 내 설정
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
#root /var/www/owners;
#auth_basic "Secret Area";
#auth_basic_user_file "/etc/nginx/htpasswd/.owners_htpasswd";
location/{
alias /var/www/owners/htdocs;
index index.php index.html index.htm;
include /etc/nginx/mime.types;
location ~ {
root /var/www/owners/htdocs;
include /etc/nginx/mime.types;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param PATH_INFO $uri;
include fastcgi_params;
try_files $uri $uri/ /index.php?$args;
}
#location ~ .*\.(css|CSS)$ {
#add_header Content-Type text/css;
#try_files $uri $uri/ *.css;
#}
#if ($request_filename ~* ^.*?/([^/]*?)$){
#set $filename $1;
#}
#if ($filename ~* ^.*?\.css$){
#add_header Content-Type text/css;
#}
#location ~ \.css$ {
#add_header Content-Type text/css;
#}
#location/{
#if ($script_filename !~ "-f") {
#rewrite !\.ico$ /index\.php break;
#}
#}
}
location /admin {
alias /var/www/admin;
index index.html index.htm index.php;
}
location /phpmyadmin {
alias /usr/share/phpMyAdmin;
index index.php;
location ~ ^/phpmyadmin/(.+\.php)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^/phpmyadmin/(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME /usr/share/phpMyAdmin/$fastcgi_script_name;
include fastcgi_params;
}
break;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
여기입니다
DirectoryIndex index.html index.php bukken.php
# rewrite関連
RewriteEngine On
RewriteRule .*/\.svn/.*/[F]
RewriteRule \.svn/.*/[F]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule !\.ico$ index\.php [L]
# php.ini関連
php_flag session.auto_start 0
php_flag magic_quotes_gpc 0
php_value session.use_trans_sid 0
php_value session.use_cookies 1
php_value session.use_only_cookie 0
php_value session.gc_maxlifetime 14400
php_value upload_tmp_dir /tmp/upload
php_value post_max_size 32M
php_value upload_max_filesize 32M
php_value url_rewriter.tags "a=href,area=href,frame=src,form=,fieldset=,img=src"
이 도와주세요 htaccess로에게 구글하지만 아무것도 도움
에 검색. 미안 대한 때문에 내 나쁜 영어
감사합니다. – user3783161