使用Ubuntu16.04搭建CMS服务器

2022-11-19 16:25:07 浏览数 (1)

大家好,又见面了,我是你们的朋友全栈君。

以此为笔记,方便后面查阅。

以下是正文。

注:使用root帐号或每条shell命令前加sudo.

1. 安装Ubuntu16.04版本。

2. 安装后,进入系统,打开终端,开始使用以下shell命令进行搭建。

3. apt-get update

4. apt-get upgrade -y

5. 添加ppa软件源: 1).apt-get install -y python-software-properties 2).apt-key adv –keyserver ha.pool.sks-keyservers.net –recv-keys 4F4EA0AAE5267A6C 3).add-apt-repository -y ppa:ondrej/php 4).apt-get update

6. 安装nginx: apt-get install -y nginx-full

7. 安装apt-get install -y mysql-server(默认版本为5.7): apt-get install -y mysql-server 然后设置mysql root密码

8. 安装php5.6及依赖 apt-get install -y php5.6-fpm php5.6-cli php5.6-phar php5.6-soap php5.6-gd php5.6-dom php5.6-mcrypt php5.6-zip php5.6-mysql php5.6-curl

9. 安装php zeromq apt-get install -y php-zmq

10. 将git cms源版复制到/var/wwww cp -r /home/xxx/cms/delta/shared/cms/* /var/www chown -R www-data:www-data /var/www

11. 配置cms环境 1).备份ngnix.conf mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.old 2).将当前目录conf文件夹中的nginx.conf覆盖到/etc/nginx/nginx.conf cp -f confs/nginx.conf /etc/nginx/nginx.conf 3).将当前目录conf文件夹中的xibo_vhost_conf覆盖到/etc/nginx/sites-available/xibo_vhost_conf cp -f confs/xibo_vhost_conf /etc/nginx/sites-available/xibo_vhost_conf 4). rm /etc/nginx/sites-enabled/* 5). 链接该配置文件,使其真正生效 ln -s /etc/nginx/sites-available/xibo_vhost_conf /etc/nginx/sites-enabled/xibo_vhost_conf 6).nginx -t 7).systemctl reload nginx 8).备份php.ini文件 mv /etc/php/5.6/fpm/php.ini /etc/php/5.6/fpm/php.ini.old 9).将当前目录conf文件夹中的php.ini覆盖到/etc/php/5.6/fpm/php.ini cp -f confs/php.ini /etc/php/5.6/fpm/php.ini 10).systemctl reload php5.6-fpm

14.输入http://localhost或http://ip进入cms,首次进入将出现安装界面

以下附上配置文件内容nginx.config

代码语言:javascript复制
user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
      worker_connections 768;
      # multi_accept on;
}

http {

      ##
      # Basic Settings
      ##

      sendfile on;
      tcp_nopush on;
      tcp_nodelay on;
      keepalive_timeout 65;
      types_hash_max_size 2048;
      # server_tokens off;

      # server_names_hash_bucket_size 64;
      # server_name_in_redirect off;

      include /etc/nginx/mime.types;
      default_type application/octet-stream;
      client_max_body_size 256m;

      # fastcgi settings
      fastcgi_connect_timeout 300s;
      fastcgi_send_timeout 300s;
      fastcgi_read_timeout 300s;
      fastcgi_buffer_size 128k;
      fastcgi_buffers 8 128k;


      ##
      # SSL Settings
      ##

      ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
      ssl_prefer_server_ciphers on;

      ##
      # Logging Settings
      ##

      access_log /var/log/nginx/access.log;
      error_log /var/log/nginx/error.log;

      ##
      # Gzip Settings
      ##

      gzip on;
      gzip_disable "msie6";

      ##
      # Virtual Host Configs
      ##

      include /etc/nginx/conf.d/*.conf;
      include /etc/nginx/sites-enabled/*;
}

xibo_vhost_conf

代码语言:javascript复制
server {
      listen 80 default_server;
      listen [::]:80 default_server;

      root /var/www/web;

      index index.php index.html index.htm;

      server_name _;

      location / {
        try_files $uri /index.php?$args;
      }

      location /api/authorize {
        try_files $uri /api/authorize/index.php?args;
      }

      location /api {
        try_files $uri /api/index.php?$args;
      }

      location /install {
        try_files $uri /install/index.php?$args;
      }

      location /maint {
        try_files $uri /maint/index.php?$args;
      }

      location /maintenance {
        try_files $uri /index.php?$args;
      }

      location ~ .php$ {
        include snippets/fastcgi-php.conf;

        fastcgi_pass unix:/run/php/php5.6-fpm.sock;
      }
}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/180355.html原文链接:https://javaforall.cn

0 人点赞