Category Archives: Linux

Solving the problem of nginx reverse proxy web service soap:address location problem

One: First, let’s publish a web service

package com.ws.service;

public interface IUserService
{
public String getUserName(String id);
}
package com.ws.service;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

@WebService
public class UserService implements IUserService
{
@WebMethod
public String getUserName(@WebParam(name=”id”) String id)
{
return “User:” + id;
}
}
package com.ws.service;

import javax.xml.ws.Endpoint;

public class Server
{
public static void main(String[] args)
{
Endpoint.publish(“http://0.0.0.0:6633/api/v1/user”, new UserService());
System.out.println(“ws startup ok on port ” + 6633);
}
}

The port of ws is 6633
The access address is: http://192.168.100.95:6633/api/v1/user?wsdl

Then, nginx is configured as follows.

upstream webservice {
server 192.168.10.95:6633;
}
server {
listen 6633;
location/{
proxy_pass http://webservice;
}
}

The nginx address is: 192.168.2.123
Then visit the proxy address: http://192.168.2.123:6633/api/v1/user?wsdl

The result is as follows

The address here is clearly wrong.

The solution is as follows

The nginx configuration is changed to

upstream webservice {
server 192.168.100.95:6633;
}
server {
listen 6633;
location/{
proxy_set_header Host $host:$server_port;
proxy_pass http://webservice;
}
}

The reason for this is that if you don’t configure
proxy_set_header Host $host:$server_port;
then, nginx reverse proxy to the backend, passing the Host http header as
Host=webservice

Ubuntu Startup Error: “piix4_smbus 0000:00:07.3: SMBus Host controller not enabled”

Why can’t you grab tickets when you travel on holiday?Reveal the key technology of 12306 how to ensure the ticket is not oversold>>>

Problem Description: prompt “piix4” when Ubuntu starts up_ smbus 0000:00:07.3: SMBus Host controller not enabled”

Version: Ubuntu 18.04 VMware 14.0

Reason: I2C is loaded into the system_ Piix4 module, because the system can not find this module, so an error is reported

Solution: 1. Find out the exact name of the loading module. Command: lsmod | grep I2C (query result: I2C_ Piix4 module)

2. Put the module in the no load list. Edit file command: sudo VI/etc/modprobe.d/blacklist.conf, add blacklist I2C to the last line of the file_ Piix4, save and exit

3. Regenerate the boot file. Command: sudoupdate initramfs – U – K all

4. Restart the system. Command: Reboot

Command screenshot:

How to Solve SVN Error: svn:Checksum mismatch while updating

Error executing SVN update:

svn:Checksummismatchwhileupdating'D:\workspace\demo\test\.svn\text-base\test.php.svn-base';expected:'e46703b45e810605fd7513943533b00f',actual:'5480a41836d19692a1a85e667d222e82'

The file identification code is inconsistent between local and remote. Under the condition of ensuring the consistency between the two, use the following methods to solve the problem:
1. Find the directory where the file is located eg: D:// workspace/demo/test \
2. Show all hidden files and find the. SVN/entries file in the directory
3. Remove the read-only attribute of the file
4. Edit the file to find the file

10630test.phpfile29152011-09-23T02:16:30.000000Ze46703b45e810605fd7513943533b00f2011-09-14T06:42:48.305470Z2915yuchangfeng

5. Change ‘e46703b45e810605fd7513943533b00f’ to ‘5480a41836d19692a1a85e667d222e82’
6. Save the file and update it again

 

E09 Error: sudo: effective uid is not 0, is sudo installed setuid root?

Solution 1

If you switch the root permissions with normal users: sudo: effective uid is not 0, is sudo installed setuid root

Using LS – L/usr/bin/sudo, you will find that the file will show red, and the owner is root, that is, the user with uid 0. And the execution of the program is set to s (suid), which means that the user executing the program will temporarily obtain the permission of the owner, that is, the root account

the principle is: sudo will check whether the current user’s definition of using a command is defined in/etc/sudoers. For example, if you use: sudo useradd user1, sudo will check whether user1 has the definition of user add permission. If so, it will temporarily upgrade the permissions of user1 to root to perform the useradd operation. Otherwise, the implementation will be refused

Solution:

chown root.root /usr/bin/sudo

CHMOD U + S/usr/bin/sudo

chmod go-w /usr/libexec/sudoers.so

Solution 2

It is mainly applied to a command Yum reinstall ` RPM – QF/usr/bin/sudo`

[Solved] Forbid root, handle error sudo must be owned by uid 0

1. Using a non root login is an error in sudo

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
Processing: After re-logging in
chown root:root /usr/bin/sudo
chmod 4755 /usr/bin/sudo

2. Disable root remote login

*** Not disable root login, not root account
#sudo vim/etc/ssh/sshd_config
Find PermitRootLogin yes and change it to no
*** If the reverse is true, restore root remote, find
Find and comment out this line: PermitRootLogin prohibit-password
PermitRootLogin no to yes

** After the change, sudo /etc/init.d/sshd restart, or just reboot and reboot

3. Other accounts join sudo

First switch to root
Execute su and enter the password
vi /etc/sudoers and add XXX (username) to the following
# User privilege specification
	 root   ALL=(ALL:ALL) ALL
	dhbm    ALL=(ALL:ALL) ALL

Git submodule Update Error: ‘open_source_code/openh264’ already exists in the index

When you clone a repo on github that contains a submodule, update the submodule with the following command.git submodule update –remote –merge

If you can’t update, try re-adding the submodule, for example:

git submodule add https://github.com/cisco/openh264 open_source_code/openh264

Keeps giving the following error.
‘open_source_code/openh264’ already exists in the index

Run the following command to fix the problem.

git rm -r --cached open_source_code/openh264

Ubuntu mount error(13): Permission denied window

ubuntu Permission error is reported under mount window directory:

CIFS VFS: cifs_mount failed w/return code = -13

Status code returned 0xc000006d NT_STATUS_LOGON_FAILURE

After trying many ways, I finally added the following parameter to the command and it was OK

sec=ntlm

Full command:

sudo mount.cifs -o sec=ntlm,username=Administrator,password='test' //192.168.8.105/workspace /root/mnt

sshd Start Report Error: sshd re-exec requires execution with an absolute path

# sudo /usr/sbin/sshd
Error:
Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Could not load host key: /etc/ssh/ssh_host_ed25519_key
Missing privilege separation directory: /run/sshd

Solution:
# sudo ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
# sudo ssh-keygen -t ecdsa -f  /etc/ssh/ssh_host_ecdsa_key
# sudo ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key