centos7.5上安装nginx

 

停止与启动

[root@wole sbin]# ./nginx -s stop
[root@wole sbin]# ./nginx

nginx配置多个端口访问

拷贝配置文件中的server,然后修改端口

 

 

47.104.180.10

https://blog.csdn.net/u012998306/article/details/98960070

 

[root@wole conf]# pwd
/usr/local/nginx/conf

[root@wole conf]# more nginx.conf

#user nobody;
#worker_processes 1;

worker_processes 8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}


http {
include 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 logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

server {
listen 80;
server_name localhost;
root /opt/www;
client_max_body_size 2000m; 
#charset koi8-r;

#access_log logs/host.access.log main;

location / {
index index.php index.html index.htm;
if (!-d $request_filename){
set $rule_0 1$rule_0;
}
if (!-f $request_filename){
set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
rewrite ^/(.*)$ /index.php/$1 last;
}
}

#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 html;
}
#pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}

}
}

 

  

posted @ 2019-11-15 16:30  ggsa202008  阅读(102)  评论(0编辑  收藏  举报