分类目录归档:应用

ssh连接到virtualbox 里面的linux

The best way to login to a guest Linux VirtualBox VM is port forwarding. By default, you should have one interface already which is using NAT. Then go to the Network settings and click the Port Forwarding button. Add a new Rule:

Host port 3022, guest port 22, name ssh, other left blank.
or from command line

VBoxManage modifyvm myserver –natpf1 “ssh,tcp,,3022,,22”
where ‘myserver’ is the name of the created VM. Check the added rules:

VBoxManage showvminfo myserver | grep ‘Rule’
That’s all! Please be sure you don’t forget to install an SSH server:

sudo apt-get install openssh-server

To SSH into the guest VM, write:

ssh -p 3022 user@127.0.0.1

Where user is your username within the VM.

参考:http://stackoverflow.com/questions/5906441/how-to-ssh-to-a-virtualbox-guest-externally-through-a-host

2017年,你好!

新年好!这一年,我将继续努力,为了更好的未来而继续努力!

2017年,我希望我们拥有更多的美好!我相信一切美好的事情都会不断发生,因为我会变得更好!

工作、家庭、生活、梦想、社会进步,…希望这一切都变得更好!

希望地球变得更好,希望国家变得更好,希望每一个人都变得更好!

wordpress登录后站点出现 502错误

最近发现,wordpress 4.7 在登录后,如果再次访问自己站点会直接出现502错误,但是如果非登录状态,则访问都是正常的。这个现象非常奇怪。无论如何,先登录服务器看日志:

tail -f /var/log/nginx/error.log

然后在登录状态下访问我的网站,发现有如下日志,

2016/12/21 14:59:57 [error] 8551#0: *26 upstream sent too big header while reading response header from upstream, client: **.*.*.*, server: idocbox.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "idocbox.com", referrer: "http://idocbox.com/wp-admin/plugins.php?plugin_status=all&paged=1&s"

看来是头信息过大导致超时了,所以出现了502错误。一番简单搜索,得到如下解决方案:

sudo vi /etc/nginx/sites-enabled/idocbox.com

在里面增加

                fastcgi_buffer_size 128k;
                fastcgi_buffers 32 32k;

修改后配置片段,

location ~ \.php$ {
                fastcgi_buffer_size 128k;
                fastcgi_buffers 32 32k;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
        #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        #
        #       # With php5-cgi alone:
        #       fastcgi_pass 127.0.0.1:9000;
        #       # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;

        include fastcgi_params;
        }

然后重启nginx,

sudo service nginx restart

验证:再次在登录状态下访问网站,网站正常了,日志里面也没有了那个“upstream sent too big” 错误。