配置nginx
- 首先在桌面打开命令提示
- 登录你云服务器的账号
ssh root@123.60.27.186后面IP地址是公网上面的ip地址 然后输入密码进入系统 - cd / 进入根目录 ls 列出文件内容
- 安装 nginxyum install -y nginx
- 这种安装方式 的就进入etc/nginx建立一个vhost的文件里面放一个 你的域名.conf的文件
放进下面这段代码 星号代表的是你注册的域名
#upstream goserver {
# server 127.0.0.1:9000;
#}
server {
listen 80;
server_name ****;
# return 301 https://$server_name$request_uri;
#}
#server{
# listen 443 ssl;
# server_name api.bdplus.cn;
root /home/www/*******;
#ssl on;
# ssl_certificate /data/sys/cert/1531404801208/1531404801208.pem;
# ssl_certificate_key /data/sys/cert/1531404801208/1531404801208.key;
# ssl_session_timeout 5m;
# ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
# ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# ssl_prefer_server_ciphers on;
# location / {
# index index.php index.html index.htm;
# }
#location / {
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header Host $http_host;
# proxy_redirect off;
# proxy_pass http://goserver;
# }
# location ^~/api/{
#rewrite ^/api/(.*)/$1 break;
#proxy_pass http://api.bdplus.cn/api/;
#}
# location ^~/home/{
# rewrite ^/home/(.*)/$1 break;
# proxy_pass https://home-api.pinduoduo.com/home/;
#}
location /{
try_files $uri /index.html;
index index.html index.htm index.php;
}
location ~ /\. {
return 403;
}
access_log /data/log/www/******;
}
复制代码
- cd / 根目录 ls查看文件有home进入home没有创建home 进入home在创建www进入www 在进入 创建 你的域名 在进入里面创建一个 index.html 内容随意 cd / 到根目录 在创建data 在创建log 这是日志存在的地方
include vhost/*.conf;
mkdir 新建文件夹
vi 新建文件
cd 进入
cd .. 后退
cd / 进入根目录
i 输入
esc shift+: wq 保存退出 qt 不保存退出
rm -rf 删除文件
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END