Configure Proxy Clients to connect to the Proxy server Centos 7

Configure proxy settings like follows on CentOS Client.

[root@client ~]#

vi /etc/profile
# add follows to the end (set proxy settings to the environment variables)
HTTP_PROXY=$MY_PROXY_URL
HTTPS_PROXY=$MY_PROXY_URL
FTP_PROXY=$MY_PROXY_URL
http_proxy=$MY_PROXY_URL
https_proxy=$MY_PROXY_URL
ftp_proxy=$MY_PROXY_URL
export HTTP_PROXY HTTPS_PROXY FTP_PROXY http_proxy https_proxy ftp_proxy
[root@client ~]#

source /etc/profile
# it’s OK all, but it’s possible to set proxy settings for each application like follows

 

# for yum

 

[root@client ~]#

vi /etc/yum.conf
# add to the end

proxy=http://prox.srv.world:3128/

# for wget

 

[root@client ~]#

vi /etc/wgetrc
# add to the end

http_proxy = http://prox.srv.world:3128/
https_proxy = http://prox.srv.world:3128/
ftp_proxy = http://prox.srv.world:3128/

 

Advertisements

CodeIgniter Nginx Rewrite Rules

Minimum config for CodeIgniter Skeleton:

server {
    listen       80;
    server_name  www.example.com example.com;
    
    root /var/www/example.com/html;
    index index.php index.html index.htm;
    
    # Enable rewrite error log
    # error_log /var/log/nginx/localhost.error_log debug;
    # rewrite_log on;
    
    # Any HTTP request other than those for assets folder, files folder and robots.txt
    # is treated as a request for your index.php file.
    location ~* ^/(assets|files|robots\.txt) { }
    location / {
        try_files $uri $uri/ /index.php?/$request_uri;
    }
    
    # Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /var/www/example.com/html$fastcgi_script_name;
        include        fastcgi_params;
    }
    
    # Deny access to .htaccess files, if Apache's document root
    # concurs with Nginx's one
    location ~ /\.ht {
        deny  all;
    }
}

CodeIgniter Nginx Rewrite Rules

server {
    listen       80;
    server_name  www.example.com example.com;
    
    root /var/www/example.com/html;
    index index.php index.html index.htm;
    
    # Enable rewrite error log
    # error_log /var/log/nginx/localhost.error_log debug;
    # rewrite_log on;
    
    # Any HTTP request other than those for assets folder, files folder and robots.txt
    # is treated as a request for your index.php file.
    location ~* ^/(assets|files|robots\.txt) { }
    location / {
        try_files $uri $uri/ /index.php?/$request_uri;
    }
    
    # Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /var/www/example.com/html$fastcgi_script_name;
        include        fastcgi_params;
    }
    
    # Deny access to .htaccess files, if Apache's document root
    # concurs with Nginx's one
    location ~ /\.ht {
        deny  all;
    }
}

Configuring Nginx & CodeIgniter with Rewrite Rules

I’ve recently begun working with Nginx as we’re finally moving off of Apache in our infrastructure. The first thing I noticed is documentation for various types of configurations is a bit sporadic. A lot is outdated and many don’t use best practices.

The first application I’m working on is a CodeIgniter-based PHP site which needs a few rewrite rules to function properly. I dug up this tutorial but it unfortunately uses a lot of if statements which I quickly learned are evil in Nginx.

Below is the configuration that I’ve settled upon (for now) which takes into account some best practices including:

  • uses php-fpm for the upstream server via a unix socket
  • redirects all http://www.example.com traffic to example.com
  • passes all requests under the root to the front-controller as long as they don’t exist (allows nginx to directly serve static files)
  • prevents uncontrolled requests from being passed to php
  • prevents any access to leftover .htaccess files

I’m hoping to add some of the additional rewrite functionality found in the tutorial at a later date.

upstream php {
server unix:/var/run/php5-fpm.sock;
}
server {
# enforce NO www
server_name http://www.example.com;
return 301 $scheme://example.com$request_uri;
}
server {
listen 80;
server_name example.com;
root /home/webapps/www.example.com/;
access_log /var/log/nginx/www.example.com.access.log main;
location / {
index index.php;
# pass requests to the front controller (http://wiki.nginx.org/Pitfalls#Front_Controller_Pattern_based_packages)
# but don’t proxy everything (http://wiki.nginx.org/Pitfalls#Proxy_Everything)
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
# dont pass uncontrolled requests to php (http://wiki.nginx.org/Pitfalls#Passing_Uncontrolled_Requests_to_PHP)
try_files $uri =404;
fastcgi_pass php;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
# deny access to .htaccess files
location ~ /\.ht {
deny all;
}
}
view rawexample.com.conf hosted with ❤ by GitHub

Lupa Password Root Mysql Linux Centos

What version of mySQL are you using? I”m using 5.7.10 and had the same problem with logging on as root

There is 2 issues – why can’t I log in as root to start with, and why can I not use ‘mysqld_safe` to start mySQL to reset the root password.

I have no answer to setting up the root password during installation, but here’s what you do to reset the root password

Edit the initial root password on install can be found by running

grep 'temporary password' /var/log/mysqld.log

http://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html

Cannot insert the value null into column ‘diagram_id’, table dbo.sysdiagrams

Error Condition: Cannot insert the value null into column ‘diagram_id’, table dbo.sysdiagrams

Problem: This sometimes occurs when a SQL Server database is ported from one version to another (such as 2000 to 2005 or 2005 to 2008) or possibly also when using the SSMS for a newer version of SQL Server against and older database.

Fix: Drop and recreated dbo.sysdiagrams making the column diagram_id an identity column.

use [mydatabase]
GO
DROP TABLE [dbo].[sysdiagrams]
GO

CREATE TABLE [dbo].[sysdiagrams]

(   [name] [nvarchar](128) NOT NULL,
[principal_id] [int] NOT NULL,
[diagram_id] [int] identity(1,1) NOT NULL,
[version] [int] NULL,
[definition] [varbinary](max) NULL
)
GO

NOTE: If you want to preserve the diagrams, then rename the table and create a new one, then SELECT – INTO to copy the data into the new table.

RecyclerView – Android

n this post, we are going to load the list of posts from PCSalt.com. In our previous post, JSON Parsing – Android, we used ListView to display a list of posts. But, in this post, we are going to use RecyclerView to display it.

Almost all parsing and model classes are used from that post. If you haven’t followed that post, don’t worry. We are going to write all code here. This project has been uploaded to GitHub.

Create a new Android project using following information.