选择云服务器CentOS 7.6 做为系统,web环境。
选择安装nginx为http转发。
1.安装nginx YUM源
2. yum安装
3. 重启服务
4. 设置开机启动
server {
# listen 80 default_server;
# listen [::]:80 default_server;
# server_name _;
listen 80;
server_name www.qihangyun.net m.qihangyun.net;
root /data/wwwroot/dir;
index index.php index.html index.htm;
error_log “/home/web/logs/nginx_www_error.log”;
# Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
location / {
try_files $uri $uri/ /index.php?$args;
#rewrite ^/archives/(.*)$ /index.php/$1;
}
location ~ \.php(.*)$ {
#proxy_buffering off;
#fastcgi_buffers 256 128k;
#chunked_transfer_encoding off;
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;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
copy一个test.html 到 /data/wwwroot/dir/下
XXX.XXX.XXX.XXX/test.html