Modify the same as native code to modify the remote server PHP website

Vps directory maps to find their own way of recording computer

Recently took discuz made a website, you need to modify the class template file, it also needs to be debugged and micro letter QQ login interface. These positions are scattered small changes, but some need to be able to debug on-line (oauth QQ micro-channel landing, various plug-ins). In order to facilitate the development, I intend to install on a server centos Ali cloud vpn smb service and then connect to the VPN on my development machine and create a network disk mapping.

 

lab environment:

Ali cloud server server centos7

The client ordinary windows 10 operating system

 

experiment procedure:

1, PPTP VPN (unstable and therefore discarded, you can skip pptp, directly smba + openvpn achieve the desired effect)

Looking for a one-click script installation pptpd vpn default configuration can make pptpd run through the middle forget Ali cloud centos7 default use of this service is firewalld firewall, and later

systemctl stop firewalld

systemctl disable firewalld

  Closed the firewall, using only lightweight Ali cloud server firewall to open the appropriate ports. Here we find firewalld service took some time. pptp connection is established

 

2, installation smba service on centos7

 smba services are used to share files on the linux operating system or network service directory to the windows. After that is installed on linux you can specify certain folders shared to a local area network, windows LAN computer through Network Neighborhood or directly in the file browser address bar enter the server IP

\\XXX.XXX.XXX.XXX

File the appropriate directory server to operate.

First check whether the system is installed samba service, you can use

service smb status

or

systemctl staus smb

To view the status, if not installed, use

yum -y install samba

To install the samba service, after installation use

vim /etc/samba/smb.conf

Modify profile settings. Configuration file contents are more important here to pick a few out about:

The first is the [global] Here are some global settings:

#这是网上邻居的所属工作组名
workgroup = MYGROUP
#这个没看到哪里用
server string = Samba Server Version %v
#这个是网上邻居显示的计算机名
netbios name = AliyunLite
#日志文件位置 
log file = /var/log/samba/log.%m #日志文件最大容量(KB) max log size = 50 #安全性设置,通常默认设置够用 security = user passdb backend = tdbsam #使用远程局域网里的打印机,如果是公司VPN会用到,这里用不到 load printers = no map to guest = Bad User unix charset = UTF-8 ;dispaly charset = UTF-8 #创建文件和目录时候使用的默认权限,这里777免得出现权限不足问题 create mask = 777 directory mask = 777 #这个节下面的每一组都是一个共享文件夹,这里我只配置了我自己的 #============================ Share Definitions ============================== #共享文件夹的名字 [xxx] #共享文件夹注释 comment = xxx #在服务器上的路径 path = /xxx/xxx public = yes writable = yes read only = no printable = no #允许访客匿名访问 guest ok = yes browseable = yes ;write list = +staff

The above configuration samba restart service after changing for the better:

systemctl restart smb

or

service smb restart

After connecting the vpn then you can see in the file browser with \\ xxx.xxx.xxx.xxx (where vpn server address) and the operation of the file server.

 

3, for a more stable VPN connection with OpenVPN

Although pptp vpn successfully connected, but after a few minutes you need to reconnect, otherwise mapped network drives will come not send or receive any information. Remember previously used a key background bandwago installed openvpn very stable, so they switch to openvpn to build environment.

First log in using centos

wget https://gitee.com/lookingdreamer/SPPPOTools/raw/master/centos/vpn/openvpn/openvpn-install.sh

Download openvpn a key installation script. use

chmod +x openvpn-install.sh
./openvpn-install.sh

Start the installation openvpn.

Most configuration can be default values, it is recommended to ask whether the use of a secret key that when setting a secret key. But even if the secret key is not set, the intruder also need to obtain your openvpn client configuration file can log into VPN. Within this automatically generated configuration file is secret key encryption algorithm pairs.

After the installation is complete, will generate a client configuration file, you need to use ftp or tools securefx like to download the configuration file from the server. Openvpn then install a client, I have here is a windows version of the client installation, over the wall of the pipe network to openvpn download, network address is:

https://swupdate.openvpn.org/community/releases/openvpn-install-2.4.7-I607-Win10.exe

If you do not circumvention tools, can I manage to download the BBS, QQ login register at simple extraction code can be obtained by:

https://www.shuyu.online/forum.php?mod=viewthread&tid=57&page=1&extra=#pid61

After installation, start openvpn can see the bottom right corner of the task bar that displays a lock icon:

Right-click on importing a configuration file, find the configuration files generated just opened. After the import configuration can right-click on it to connect, after a successful connection can \\ 10.8.0.1 \ this address (in the file manager, which is a computer or My Computer to open) you see the file folders on the server. Right-click on the folder to create a network drive, and then it can operate as a local file operations file on the server up. I tried it phpstorm this ide, too heavyweight, intellisense may do many operations to scan network drives, can cause Caton. It is recommended to use vscode, sublime like lightweight code editor operates.

This has been directly modify files on the server in the editor, lest piecemeal changes upload and download. But there is a problem, VPN open, you may not be outside the network, or outside of the speed is very slow. Since the default setting is to use openvpn VPN server's Internet gateway, all network access will first go around on your server. This will not only slow (usually cheaper servers will 1-2M of the bandwidth) and a waste of server traffic. It also requires the following two key steps to adjust the OpenVPN configuration so that your computer does not detour via the Internet server, but directly to the Internet using the existing local gateway route:

Log into the centos server console, modify openvpn configuration file:

vim /etc/openvpn/server.conf

Find this sentence added to the front;

: Wq store closed configuration file, restart OpenVPN. Because here with one-click installation of OpenVPN installation script, and not registered as a service so systemctl and service you can not find this service. You can kill directly off and then restart the process, follow these steps:

 

This will not let your computer all traffic bypass the server.

Then modify the client configuration files, OpenVPN client icon in the lower right corner of the right, select "Edit Profile" to open the configuration file content:

Here again a prefixed;

This is to disable anti-DNS leak, if not commented out, then the original meaning is that all DNS are also gone from the DNS server, openvpn client now reconnected again, using VPN + SMB + network drive mappings can simply on your own computer the operation of the server files. Small modifications do not bother with uploading and downloading tools toss, put a ctrl + s save changes directly to the server, domain name server browser to open direct F5 to see the effect of modifying, debugging, and various online OAUTH plug-ins are also much more convenient.

 

This method applies only to small modifications, if it comes to things like database or a new module, it is recommended to get a local mirror.

I hope to give your work to bring some convenience, I spent a day around the same time take the effort to get open OPENVPN local Internet traffic issues, but also the way to learn a bit about routing tables and the like, although the last was found only need to change this two configurations do not have to toss the routing table, OPENVPN clients will automatically get complicated underlying operating, it can be considered a blessing in disguise.

If you find it useful please read Benpian a collection, you can also go to my website a few words online software IT sector for more exchange of techniques and tools to share:

https://www.shuyu.online/forum.php?gid=37

 

Related Links Summary:

samba service installation configuration:  https://www.jianshu.com/p/0d8f44d1b9ed

A key openvpn installation script:  https://segmentfault.com/a/1190000019471008

A key PPTP VPN service built script: https://blog.csdn.net/enough_empty/article/details/51106563

Guess you like

Origin www.cnblogs.com/fancybit/p/11412230.html