lnmp deployment server

Introduction: on-line deployment project

1, the project code on the server, this place will have a variety of options (look for the next time by tidy), here choose to use svn to manage the code

  • Can be installed separately lnmp own environment, you can also find a key installation
  • svn to build, take note that there are three versions of the code, the local project code a, b svn repository version of the code on the server, online access code on a server c; a principle that got me to upload to b, c to update and maintain synchronized with the b

2, configure nginx

server
    {
        listen 8083;#监听端口号
        server_name  _;#域名
        index index.html index.htm index.php;#默认打开文件
        root  /home/wwwroot/smartcloud/public;#网站根目录

        #定义变量
        set $root /home/wwwroot/smartcloud/public;

        location ~ [^/]\.php(/|$)
        {
            try_files $uri =404;
            fastcgi_pass  unix:/tmp/php-cgi.sock;
            fastcgi_index index.php;
            #设置PATH_INFO
            fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
            fastcgi_param SCRIPT_FILENAME $root$fastcgi_script_name;
            #引入fastcgi配置
            include fastcgi.conf;
        }

        #从URL中去掉index.php入口文件
        location /
        {
            if (!-e $request_filename) {
                rewrite  ^(.*)$  /index.php?s=/$1  last;
                break;
            }
        }

        #error_page   404   /404.html;
        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
        include enable-php.conf;

        location /nginx_status
        {
            stub_status on;
            access_log   off;
        }

        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
        include enable-php.conf;

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.well-known {
            allow all;
        }

        location ~ /\.
        {
            deny all;
        }

        access_log  /home/wwwlogs/access.log;
    }

3, the system problems that may arise

  • Forbidden access: access denied
    • Solution: Open the php.ini the following cgi.fix_pathinfo = 0 to 1 save and exit reboot lnmp
  • Server 500
    • The solution: put the php.ini display_errors = Off to ON save and exit reboot lnmp
  • open_basedir error
    • The solution: find nginx / conf / under fastcgi.conf file comment out the last line
  • Workman problem may arise if an error, then start stream_socket_server disabled
    • Solution to the php.ini last stream_socket_server disable_functions deleted

4. Database Import

  • First mysql configured to access an external network or direct introduction into the database mysql
  • Database port firewall settings
  • Create a read-only account
	进入sql修改
    grant all privileges on *.* to '用户名'@'%' identified by '密码' with grant option;
	创建只读用户
	GRANT select ON *.* to 'read_user'@'%' identified by 'apld#$%666';
	创建所有权限
	GRANT all privileges ON *.* to 'root'@'%' identified by '746382';
	刷新权限
	flush privileges;
  • This new connection using the account database, importing and exporting operation

5, on a number of run-time directory given 777 permissions, such as runtime

6, running again, after a successful deployment, it is recommended to maintain a project site in screen inside

Published 13 original articles · won praise 1 · views 1945

Guess you like

Origin blog.csdn.net/qq_37029718/article/details/105067957