WEB繧オ繝シ繝舌シシ哢ginx
Nginx縺ィ縺ッ
WEB繧オ繝シ繝
Apache縺ィ縺ョ驕輔>
豈碑シ鬆逶ョ | Apache | Nginx | 蛯呵 |
---|---|---|---|
繧キ繧ァ繧「 | 螟ァ | 蟆 | 2021蟷エ迴セ蝨ィ |
蜷梧凾隍謨ー繧「繧ッ繧サ繧ケ縺ク縺ョ蜃ヲ逅 | 1繧「繧ッ繧サ繧ケシ1蜃ヲ逅 | 隍謨ー繧「繧ッ繧サ繧ケシ1蜃ヲ逅 | |
蜷梧凾隍謨ー繧「繧ッ繧サ繧ケ逋コ逕滓凾縺ョ蜃ヲ逅騾溷コヲ | 驕 | 騾 | |
髮」譏灘コヲ | 菴 | 鬮 |
險ュ螳壹ヵ繧。繧、繝ォ
荳隕ァ
窶サUbuntu萓
繝輔ぃ繧、繝ォ蜷 | 讖溯ス | 繝代せ | 蛯呵 |
---|---|---|---|
nginx.conf | 蜷險ュ螳壹ヵ繧。繧、繝ォ縺ョ隱ュ霎シ繝代せ縲√Ο繧ー遲 | /etc/nginx/ | |
default.conf | server險ュ螳 | /etc/nginx/ | |
nginx.conf
user縲nginx;
worker_processes縲1;
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;
縲#tcp_nopush縲 on;
縲keepalive_timeout縲65;
縲#gzip縲on;
縲include /etc/nginx/conf.d/*.conf;
}
default.conf
server {
縲listen縲縲 80;
縲server_name縲localhost;
縲#charset koi8-r;
縲#access_log縲/var/log/nginx/log/host.access.log縲main;
縲location / {
縲縲root縲 /usr/share/nginx/html;
縲縲index縲index.html index.htm;
縲}
縲#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;
縲}
縲# proxy the PHP scripts to Apache listening on 127.0.0.1:80
縲#
縲#location ~ \.php$ {
縲#縲proxy_pass縲 http://127.0.0.1;
縲#}
縲# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
縲php繧呈桶縺蝣エ蜷医ッ莉・荳九r譛牙柑縺ォ
縲シ挾hp縺ク縺ョ繝ェ繧ッ繧ィ繧ケ繝医ョ蝣エ蜷医↓PHP-FPM縺ォ蜃ヲ逅繧貞女縺第ク。縺呵ィュ螳
縲#location ~ \.php$ {
縲#縲root縲縲縲 html;
縲#縲fastcgi_pass縲 127.0.0.1:9000;
縲#縲fastcgi_index縲index.php;
縲#縲fastcgi_param縲SCRIPT_FILENAME縲/scripts$fastcgi_script_name;
縲#縲include縲縲fastcgi_params;
縲#}
縲# deny access to .htaccess files, if Apache's document root
縲# concurs with nginx's one
縲#
縲#location ~ /\.ht {
縲#縲deny縲all;
縲#}
}